Revert "libjingle_unittest now compiles and passes on iOS!"
This reverts commit r5986 as it fails compilation on Mac (non-iOS). The failure was not discovered on the commitbots since they don't clobber their builds. BUG=3241 TBR=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/19399004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5997 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c891577e6d
commit
7d825e9b2c
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This file only exists because various iOS system APIs are only
|
||||
// available from Objective-C. See unixfilesystem.cc for the only use
|
||||
// (enforced by a lack of a header file).
|
||||
|
||||
#import <Foundation/NSPathUtilities.h>
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/common.h"
|
||||
#include "talk/base/pathutils.h"
|
||||
|
||||
// Return a new[]'d |char*| copy of the UTF8 representation of |s|.
|
||||
// Caller owns the returned memory and must use delete[] on it.
|
||||
static char* copyString(NSString* s) {
|
||||
const char* utf8 = [s UTF8String];
|
||||
size_t len = strlen(utf8) + 1;
|
||||
char* copy = new char[len];
|
||||
// This uses a new[] + strcpy (instead of strdup) because the
|
||||
// receiver expects to be able to delete[] the returned pointer
|
||||
// (instead of free()ing it).
|
||||
strcpy(copy, utf8);
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Return a (leaked) copy of a directory name suitable for application data.
|
||||
char* IOSDataDirectory() {
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(
|
||||
NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
ASSERT([paths count] == 1);
|
||||
return copyString([paths objectAtIndex:0]);
|
||||
}
|
||||
|
||||
// Return a (leaked) copy of a directory name suitable for use as a $TEMP.
|
||||
char* IOSTempDirectory() {
|
||||
return copyString(NSTemporaryDirectory());
|
||||
}
|
||||
|
||||
// Return the binary's path.
|
||||
void IOSAppName(talk_base::Pathname* path) {
|
||||
NSProcessInfo *pInfo = [NSProcessInfo processInfo];
|
||||
NSString* argv0 = [[pInfo arguments] objectAtIndex:0];
|
||||
path->SetPathname([argv0 UTF8String]);
|
||||
}
|
@ -25,13 +25,19 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "talk/base/fileutils.h"
|
||||
#include "talk/base/gunit.h"
|
||||
#include "talk/base/optionsfile.h"
|
||||
#include "talk/base/pathutils.h"
|
||||
|
||||
namespace talk_base {
|
||||
|
||||
#ifdef ANDROID
|
||||
static const char *kTestFile = "/sdcard/.testfile";
|
||||
#elif CHROMEOS
|
||||
static const char *kTestFile = "/tmp/.testfile";
|
||||
#else
|
||||
static const char *kTestFile = ".testfile";
|
||||
#endif
|
||||
|
||||
static const std::string kTestOptionA = "test-option-a";
|
||||
static const std::string kTestOptionB = "test-option-b";
|
||||
static const std::string kTestString1 = "a string";
|
||||
@ -50,135 +56,122 @@ static int kTestInt2 = 67890;
|
||||
static int kNegInt = -634;
|
||||
static int kZero = 0;
|
||||
|
||||
class OptionsFileTest : public testing::Test {
|
||||
public:
|
||||
OptionsFileTest() {
|
||||
Pathname dir;
|
||||
ASSERT(Filesystem::GetTemporaryFolder(dir, true, NULL));
|
||||
test_file_ = Filesystem::TempFilename(dir, ".testfile");
|
||||
OpenStore();
|
||||
}
|
||||
|
||||
protected:
|
||||
void OpenStore() {
|
||||
store_.reset(new OptionsFile(test_file_));
|
||||
}
|
||||
|
||||
talk_base::scoped_ptr<OptionsFile> store_;
|
||||
|
||||
private:
|
||||
std::string test_file_;
|
||||
};
|
||||
|
||||
TEST_F(OptionsFileTest, GetSetString) {
|
||||
TEST(OptionsFile, GetSetString) {
|
||||
OptionsFile store(kTestFile);
|
||||
// Clear contents of the file on disk.
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store.Save());
|
||||
std::string out1, out2;
|
||||
EXPECT_FALSE(store_->GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store_->GetStringValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kTestString2));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out2));
|
||||
EXPECT_FALSE(store.GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store.GetStringValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionB, kTestString2));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionB, &out2));
|
||||
EXPECT_EQ(kTestString1, out1);
|
||||
EXPECT_EQ(kTestString2, out2);
|
||||
EXPECT_TRUE(store_->RemoveValue(kTestOptionA));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->RemoveValue(kTestOptionB));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_FALSE(store_->GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store_->GetStringValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store.RemoveValue(kTestOptionA));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.RemoveValue(kTestOptionB));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_FALSE(store.GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store.GetStringValue(kTestOptionB, &out2));
|
||||
}
|
||||
|
||||
TEST_F(OptionsFileTest, GetSetInt) {
|
||||
TEST(OptionsFile, GetSetInt) {
|
||||
OptionsFile store(kTestFile);
|
||||
// Clear contents of the file on disk.
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store.Save());
|
||||
int out1, out2;
|
||||
EXPECT_FALSE(store_->GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store_->GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kTestInt1));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->SetIntValue(kTestOptionB, kTestInt2));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store_->GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_FALSE(store.GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store.GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kTestInt1));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.SetIntValue(kTestOptionB, kTestInt2));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store.GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_EQ(kTestInt1, out1);
|
||||
EXPECT_EQ(kTestInt2, out2);
|
||||
EXPECT_TRUE(store_->RemoveValue(kTestOptionA));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->RemoveValue(kTestOptionB));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_FALSE(store_->GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store_->GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kNegInt));
|
||||
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store.RemoveValue(kTestOptionA));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.RemoveValue(kTestOptionB));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_FALSE(store.GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_FALSE(store.GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kNegInt));
|
||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_EQ(kNegInt, out1);
|
||||
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kZero));
|
||||
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kZero));
|
||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
||||
EXPECT_EQ(kZero, out1);
|
||||
}
|
||||
|
||||
TEST_F(OptionsFileTest, Persist) {
|
||||
// Clear contents of the file on disk.
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store_->SetIntValue(kTestOptionB, kNegInt));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
|
||||
// Load the saved contents from above.
|
||||
OpenStore();
|
||||
EXPECT_TRUE(store_->Load());
|
||||
std::string out1;
|
||||
int out2;
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store_->GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_EQ(kTestString1, out1);
|
||||
EXPECT_EQ(kNegInt, out2);
|
||||
TEST(OptionsFile, Persist) {
|
||||
{
|
||||
OptionsFile store(kTestFile);
|
||||
// Clear contents of the file on disk.
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store.SetIntValue(kTestOptionB, kNegInt));
|
||||
EXPECT_TRUE(store.Save());
|
||||
}
|
||||
{
|
||||
OptionsFile store(kTestFile);
|
||||
// Load the saved contents from above.
|
||||
EXPECT_TRUE(store.Load());
|
||||
std::string out1;
|
||||
int out2;
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out1));
|
||||
EXPECT_TRUE(store.GetIntValue(kTestOptionB, &out2));
|
||||
EXPECT_EQ(kTestString1, out1);
|
||||
EXPECT_EQ(kNegInt, out2);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OptionsFileTest, SpecialCharacters) {
|
||||
TEST(OptionsFile, SpecialCharacters) {
|
||||
OptionsFile store(kTestFile);
|
||||
// Clear contents of the file on disk.
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store.Save());
|
||||
std::string out;
|
||||
EXPECT_FALSE(store_->SetStringValue(kOptionWithEquals, kTestString1));
|
||||
EXPECT_FALSE(store_->GetStringValue(kOptionWithEquals, &out));
|
||||
EXPECT_FALSE(store_->SetStringValue(kOptionWithNewline, kTestString1));
|
||||
EXPECT_FALSE(store_->GetStringValue(kOptionWithNewline, &out));
|
||||
EXPECT_TRUE(store_->SetStringValue(kOptionWithUtf8, kValueWithUtf8));
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_FALSE(store.SetStringValue(kOptionWithEquals, kTestString1));
|
||||
EXPECT_FALSE(store.GetStringValue(kOptionWithEquals, &out));
|
||||
EXPECT_FALSE(store.SetStringValue(kOptionWithNewline, kTestString1));
|
||||
EXPECT_FALSE(store.GetStringValue(kOptionWithNewline, &out));
|
||||
EXPECT_TRUE(store.SetStringValue(kOptionWithUtf8, kValueWithUtf8));
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_EQ(kTestString1, out);
|
||||
EXPECT_TRUE(store_->GetStringValue(kOptionWithUtf8, &out));
|
||||
EXPECT_TRUE(store.GetStringValue(kOptionWithUtf8, &out));
|
||||
EXPECT_EQ(kValueWithUtf8, out);
|
||||
EXPECT_FALSE(store_->SetStringValue(kTestOptionA, kValueWithNewline));
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_FALSE(store.SetStringValue(kTestOptionA, kValueWithNewline));
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_EQ(kTestString1, out);
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kValueWithEquals));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kValueWithEquals));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
||||
EXPECT_EQ(kValueWithEquals, out);
|
||||
EXPECT_TRUE(store_->SetStringValue(kEmptyString, kTestString2));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out));
|
||||
EXPECT_TRUE(store.SetStringValue(kEmptyString, kTestString2));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetStringValue(kEmptyString, &out));
|
||||
EXPECT_EQ(kTestString2, out);
|
||||
EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString));
|
||||
EXPECT_TRUE(store_->Save());
|
||||
EXPECT_TRUE(store_->Load());
|
||||
EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out));
|
||||
EXPECT_TRUE(store.SetStringValue(kTestOptionB, kEmptyString));
|
||||
EXPECT_TRUE(store.Save());
|
||||
EXPECT_TRUE(store.Load());
|
||||
EXPECT_TRUE(store.GetStringValue(kTestOptionB, &out));
|
||||
EXPECT_EQ(kEmptyString, out);
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
void MaybeRemapSendError() {
|
||||
#if defined(OSX) || defined(IOS)
|
||||
#if defined(OSX)
|
||||
// https://developer.apple.com/library/mac/documentation/Darwin/
|
||||
// Reference/ManPages/man2/sendto.2.html
|
||||
// ENOBUFS - The output queue for a network interface is full.
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "talk/base/physicalsocketserver.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/base/socket_unittest.h"
|
||||
#include "talk/base/testutils.h"
|
||||
#include "talk/base/thread.h"
|
||||
|
||||
namespace talk_base {
|
||||
@ -75,11 +74,21 @@ TEST_F(PhysicalSocketTest, TestConnectWithDnsLookupFailIPv6) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef OSX
|
||||
// This test crashes the OS X kernel on 10.6 (at bsd/netinet/tcp_subr.c:2118).
|
||||
TEST_F(PhysicalSocketTest, DISABLED_TestConnectWithClosedSocketIPv4) {
|
||||
#else
|
||||
TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv4) {
|
||||
#endif
|
||||
SocketTest::TestConnectWithClosedSocketIPv4();
|
||||
}
|
||||
|
||||
#ifdef OSX
|
||||
// This test crashes the OS X kernel on 10.6 (at bsd/netinet/tcp_subr.c:2118).
|
||||
TEST_F(PhysicalSocketTest, DISABLED_TestConnectWithClosedSocketIPv6) {
|
||||
#else
|
||||
TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv6) {
|
||||
#endif
|
||||
SocketTest::TestConnectWithClosedSocketIPv6();
|
||||
}
|
||||
|
||||
@ -218,7 +227,7 @@ Thread *PosixSignalDeliveryTest::signaled_thread_ = NULL;
|
||||
// Test receiving a synchronous signal while not in Wait() and then entering
|
||||
// Wait() afterwards.
|
||||
TEST_F(PosixSignalDeliveryTest, RaiseThenWait) {
|
||||
ASSERT_TRUE(ss_->SetPosixSignalHandler(SIGTERM, &RecordSignal));
|
||||
ss_->SetPosixSignalHandler(SIGTERM, &RecordSignal);
|
||||
raise(SIGTERM);
|
||||
EXPECT_TRUE(ss_->Wait(0, true));
|
||||
EXPECT_TRUE(ExpectSignal(SIGTERM));
|
||||
|
@ -172,8 +172,8 @@ void SocketTest::TestUdpIPv6() {
|
||||
}
|
||||
|
||||
void SocketTest::TestUdpReadyToSendIPv4() {
|
||||
#if !defined(OSX) && !defined(IOS)
|
||||
// TODO(ronghuawu): Enable this test on mac/ios.
|
||||
#if !defined(OSX)
|
||||
// TODO(ronghuawu): Enable this test (currently failed on build bots) on mac.
|
||||
UdpReadyToSend(kIPv4Loopback);
|
||||
#endif
|
||||
}
|
||||
|
@ -66,15 +66,6 @@
|
||||
#include "talk/base/stream.h"
|
||||
#include "talk/base/stringutils.h"
|
||||
|
||||
#if defined(IOS)
|
||||
// Defined in iosfilesystem.mm. No header file to discourage use
|
||||
// elsewhere; other places should use GetApp{Data,Temp}Folder() in
|
||||
// this file. Don't copy/paste. I mean it.
|
||||
char* IOSDataDirectory();
|
||||
char* IOSTempDirectory();
|
||||
void IOSAppName(talk_base::Pathname* path);
|
||||
#endif
|
||||
|
||||
namespace talk_base {
|
||||
|
||||
#if !defined(ANDROID) && !defined(IOS)
|
||||
@ -94,17 +85,6 @@ void UnixFilesystem::SetAppTempFolder(const std::string& folder) {
|
||||
}
|
||||
#endif
|
||||
|
||||
UnixFilesystem::UnixFilesystem() {
|
||||
#if defined(IOS)
|
||||
if (!provided_app_data_folder_)
|
||||
provided_app_data_folder_ = IOSDataDirectory();
|
||||
if (!provided_app_temp_folder_)
|
||||
provided_app_temp_folder_ = IOSTempDirectory();
|
||||
#endif
|
||||
}
|
||||
|
||||
UnixFilesystem::~UnixFilesystem() {}
|
||||
|
||||
bool UnixFilesystem::CreateFolder(const Pathname &path, mode_t mode) {
|
||||
std::string pathname(path.pathname());
|
||||
int len = pathname.length();
|
||||
@ -389,9 +369,6 @@ bool UnixFilesystem::GetAppPathname(Pathname* path) {
|
||||
return success;
|
||||
#elif defined(__native_client__)
|
||||
return false;
|
||||
#elif IOS
|
||||
IOSAppName(path);
|
||||
return true;
|
||||
#else // OSX
|
||||
char buffer[PATH_MAX + 2];
|
||||
ssize_t len = readlink("/proc/self/exe", buffer, ARRAY_SIZE(buffer) - 1);
|
||||
@ -544,7 +521,7 @@ bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path, int64 *freebytes) {
|
||||
#endif // ANDROID
|
||||
#if defined(LINUX) || defined(ANDROID)
|
||||
*freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail;
|
||||
#elif defined(OSX) || defined(IOS)
|
||||
#elif defined(OSX)
|
||||
*freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail;
|
||||
#endif
|
||||
|
||||
|
@ -36,17 +36,13 @@ namespace talk_base {
|
||||
|
||||
class UnixFilesystem : public FilesystemInterface {
|
||||
public:
|
||||
UnixFilesystem();
|
||||
virtual ~UnixFilesystem();
|
||||
|
||||
#if defined(ANDROID) || defined(IOS)
|
||||
// Android does not have a native code API to fetch the app data or temp
|
||||
// folders. That needs to be passed into this class from Java. Similarly, iOS
|
||||
// only supports an Objective-C API for fetching the folder locations, so that
|
||||
// needs to be passed in here from Objective-C. Or at least that used to be
|
||||
// the case; now the ctor will do the work if necessary and possible.
|
||||
// TODO(fischman): add an Android version that uses JNI and drop the
|
||||
// SetApp*Folder() APIs once external users stop using them.
|
||||
// Android does not have a native code API to fetch the app data or temp
|
||||
// folders. That needs to be passed into this class from Java. Similarly, iOS
|
||||
// only supports an Objective-C API for fetching the folder locations, so that
|
||||
// needs to be passed in here from Objective-C.
|
||||
|
||||
static void SetAppDataFolder(const std::string& folder);
|
||||
static void SetAppTempFolder(const std::string& folder);
|
||||
#endif
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.Google.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,55 +0,0 @@
|
||||
#
|
||||
# libjingle
|
||||
# Copyright 2014, Google Inc.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Include this .gypi in an ObjC target's definition to allow it to be
|
||||
# used as an iOS or OS/X application.
|
||||
|
||||
{
|
||||
'conditions': [
|
||||
['OS=="ios" or OS=="mac"', {
|
||||
'variables': {
|
||||
'infoplist_file': './ios_test.plist',
|
||||
},
|
||||
'mac_bundle': 1,
|
||||
'mac_bundle_resources': [
|
||||
'<(infoplist_file)',
|
||||
],
|
||||
# The plist is listed above so that it appears in XCode's file list,
|
||||
# but we don't actually want to bundle it.
|
||||
'mac_bundle_resources!': [
|
||||
'<(infoplist_file)',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES',
|
||||
# common.gypi enables this for mac but we want this to be disabled
|
||||
# like it is for ios.
|
||||
'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
|
||||
'INFOPLIST_FILE': '<(infoplist_file)',
|
||||
},
|
||||
}],
|
||||
], # conditions
|
||||
}
|
@ -657,7 +657,6 @@
|
||||
}],
|
||||
['OS=="ios"', {
|
||||
'sources': [
|
||||
'base/iosfilesystem.mm',
|
||||
'base/scoped_autorelease_pool.mm',
|
||||
],
|
||||
'dependencies': [
|
||||
|
@ -104,7 +104,6 @@
|
||||
{
|
||||
'target_name': 'libjingle_unittest',
|
||||
'type': 'executable',
|
||||
'includes': [ 'build/ios_tests.gypi', ],
|
||||
'dependencies': [
|
||||
'gunit',
|
||||
'libjingle.gyp:libjingle',
|
||||
@ -493,27 +492,51 @@
|
||||
# does just fine on 10.6 too).
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'libjingle_peerconnection_objc_test',
|
||||
'target_name': 'libjingle_peerconnection_objc_test',
|
||||
'variables': {
|
||||
'infoplist_file': './app/webrtc/objctests/Info.plist',
|
||||
},
|
||||
'type': 'executable',
|
||||
'includes': [ 'build/ios_tests.gypi', ],
|
||||
'mac_bundle': 1,
|
||||
'mac_bundle_resources': [
|
||||
'<(infoplist_file)',
|
||||
],
|
||||
# The plist is listed above so that it appears in XCode's file list,
|
||||
# but we don't actually want to bundle it.
|
||||
'mac_bundle_resources!': [
|
||||
'<(infoplist_file)',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES',
|
||||
# common.gypi enables this for mac but we want this to be disabled
|
||||
# like it is for ios.
|
||||
'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
|
||||
'INFOPLIST_FILE': '<(infoplist_file)',
|
||||
},
|
||||
'dependencies': [
|
||||
'gunit',
|
||||
'libjingle.gyp:libjingle_peerconnection_objc',
|
||||
],
|
||||
'FRAMEWORK_SEARCH_PATHS': [
|
||||
'$(inherited)',
|
||||
'$(SDKROOT)/Developer/Library/Frameworks',
|
||||
'$(DEVELOPER_LIBRARY_DIR)/Frameworks',
|
||||
],
|
||||
'sources': [
|
||||
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.h',
|
||||
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.m',
|
||||
'app/webrtc/objctests/RTCPeerConnectionTest.mm',
|
||||
'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h',
|
||||
'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m',
|
||||
# TODO(fischman): figure out if this works for ios or if it
|
||||
# needs a GUI driver.
|
||||
'app/webrtc/objctests/mac/main.mm',
|
||||
],
|
||||
'FRAMEWORK_SEARCH_PATHS': [
|
||||
'$(inherited)',
|
||||
'$(SDKROOT)/Developer/Library/Frameworks',
|
||||
'$(DEVELOPER_LIBRARY_DIR)/Frameworks',
|
||||
'conditions': [
|
||||
['OS=="mac" or OS=="ios"', {
|
||||
'sources': [
|
||||
# TODO(fischman): figure out if this works for ios or if it
|
||||
# needs a GUI driver.
|
||||
'app/webrtc/objctests/mac/main.mm',
|
||||
],
|
||||
}],
|
||||
],
|
||||
}, # target libjingle_peerconnection_objc_test
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user