libjingle_unittest now compiles and passes on iOS!
Example run from cmd-line: ninja -C out_ios/Debug-iphoneos libjingle_unittest && ~/src/ios-deploy/ios-deploy -d -u -v -b ~/src/wr/trunk/out_ios/Debug-iphoneos/libjingle_unittest.app Note that the test's use of signals means that lldb will break in the middle of the suite. To ignore these signals tell lldb: pro hand -p true -s false -n false SIGINT pro hand -p true -s false -n false SIGTERM continue BUG=3241 R=noahric@google.com, tkchin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12229004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5986 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8f69330310
commit
95cd1551f8
70
talk/base/iosfilesystem.mm
Normal file
70
talk/base/iosfilesystem.mm
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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,19 +25,13 @@
|
|||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "talk/base/fileutils.h"
|
||||||
#include "talk/base/gunit.h"
|
#include "talk/base/gunit.h"
|
||||||
#include "talk/base/optionsfile.h"
|
#include "talk/base/optionsfile.h"
|
||||||
|
#include "talk/base/pathutils.h"
|
||||||
|
|
||||||
namespace talk_base {
|
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 kTestOptionA = "test-option-a";
|
||||||
static const std::string kTestOptionB = "test-option-b";
|
static const std::string kTestOptionB = "test-option-b";
|
||||||
static const std::string kTestString1 = "a string";
|
static const std::string kTestString1 = "a string";
|
||||||
@ -56,122 +50,135 @@ static int kTestInt2 = 67890;
|
|||||||
static int kNegInt = -634;
|
static int kNegInt = -634;
|
||||||
static int kZero = 0;
|
static int kZero = 0;
|
||||||
|
|
||||||
TEST(OptionsFile, GetSetString) {
|
class OptionsFileTest : public testing::Test {
|
||||||
OptionsFile store(kTestFile);
|
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) {
|
||||||
// Clear contents of the file on disk.
|
// Clear contents of the file on disk.
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
std::string out1, out2;
|
std::string out1, out2;
|
||||||
EXPECT_FALSE(store.GetStringValue(kTestOptionA, &out1));
|
EXPECT_FALSE(store_->GetStringValue(kTestOptionA, &out1));
|
||||||
EXPECT_FALSE(store.GetStringValue(kTestOptionB, &out2));
|
EXPECT_FALSE(store_->GetStringValue(kTestOptionB, &out2));
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionB, kTestString2));
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kTestString2));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out1));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out1));
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionB, &out2));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out2));
|
||||||
EXPECT_EQ(kTestString1, out1);
|
EXPECT_EQ(kTestString1, out1);
|
||||||
EXPECT_EQ(kTestString2, out2);
|
EXPECT_EQ(kTestString2, out2);
|
||||||
EXPECT_TRUE(store.RemoveValue(kTestOptionA));
|
EXPECT_TRUE(store_->RemoveValue(kTestOptionA));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.RemoveValue(kTestOptionB));
|
EXPECT_TRUE(store_->RemoveValue(kTestOptionB));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_FALSE(store.GetStringValue(kTestOptionA, &out1));
|
EXPECT_FALSE(store_->GetStringValue(kTestOptionA, &out1));
|
||||||
EXPECT_FALSE(store.GetStringValue(kTestOptionB, &out2));
|
EXPECT_FALSE(store_->GetStringValue(kTestOptionB, &out2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OptionsFile, GetSetInt) {
|
TEST_F(OptionsFileTest, GetSetInt) {
|
||||||
OptionsFile store(kTestFile);
|
|
||||||
// Clear contents of the file on disk.
|
// Clear contents of the file on disk.
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
int out1, out2;
|
int out1, out2;
|
||||||
EXPECT_FALSE(store.GetIntValue(kTestOptionA, &out1));
|
EXPECT_FALSE(store_->GetIntValue(kTestOptionA, &out1));
|
||||||
EXPECT_FALSE(store.GetIntValue(kTestOptionB, &out2));
|
EXPECT_FALSE(store_->GetIntValue(kTestOptionB, &out2));
|
||||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kTestInt1));
|
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kTestInt1));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.SetIntValue(kTestOptionB, kTestInt2));
|
EXPECT_TRUE(store_->SetIntValue(kTestOptionB, kTestInt2));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||||
EXPECT_TRUE(store.GetIntValue(kTestOptionB, &out2));
|
EXPECT_TRUE(store_->GetIntValue(kTestOptionB, &out2));
|
||||||
EXPECT_EQ(kTestInt1, out1);
|
EXPECT_EQ(kTestInt1, out1);
|
||||||
EXPECT_EQ(kTestInt2, out2);
|
EXPECT_EQ(kTestInt2, out2);
|
||||||
EXPECT_TRUE(store.RemoveValue(kTestOptionA));
|
EXPECT_TRUE(store_->RemoveValue(kTestOptionA));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.RemoveValue(kTestOptionB));
|
EXPECT_TRUE(store_->RemoveValue(kTestOptionB));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_FALSE(store.GetIntValue(kTestOptionA, &out1));
|
EXPECT_FALSE(store_->GetIntValue(kTestOptionA, &out1));
|
||||||
EXPECT_FALSE(store.GetIntValue(kTestOptionB, &out2));
|
EXPECT_FALSE(store_->GetIntValue(kTestOptionB, &out2));
|
||||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kNegInt));
|
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kNegInt));
|
||||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||||
EXPECT_EQ(kNegInt, out1);
|
EXPECT_EQ(kNegInt, out1);
|
||||||
EXPECT_TRUE(store.SetIntValue(kTestOptionA, kZero));
|
EXPECT_TRUE(store_->SetIntValue(kTestOptionA, kZero));
|
||||||
EXPECT_TRUE(store.GetIntValue(kTestOptionA, &out1));
|
EXPECT_TRUE(store_->GetIntValue(kTestOptionA, &out1));
|
||||||
EXPECT_EQ(kZero, out1);
|
EXPECT_EQ(kZero, out1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OptionsFile, Persist) {
|
TEST_F(OptionsFileTest, Persist) {
|
||||||
{
|
// Clear contents of the file on disk.
|
||||||
OptionsFile store(kTestFile);
|
EXPECT_TRUE(store_->Save());
|
||||||
// Clear contents of the file on disk.
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->SetIntValue(kTestOptionB, kNegInt));
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.SetIntValue(kTestOptionB, kNegInt));
|
|
||||||
EXPECT_TRUE(store.Save());
|
// Load the saved contents from above.
|
||||||
}
|
OpenStore();
|
||||||
{
|
EXPECT_TRUE(store_->Load());
|
||||||
OptionsFile store(kTestFile);
|
std::string out1;
|
||||||
// Load the saved contents from above.
|
int out2;
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out1));
|
||||||
std::string out1;
|
EXPECT_TRUE(store_->GetIntValue(kTestOptionB, &out2));
|
||||||
int out2;
|
EXPECT_EQ(kTestString1, out1);
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out1));
|
EXPECT_EQ(kNegInt, out2);
|
||||||
EXPECT_TRUE(store.GetIntValue(kTestOptionB, &out2));
|
|
||||||
EXPECT_EQ(kTestString1, out1);
|
|
||||||
EXPECT_EQ(kNegInt, out2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OptionsFile, SpecialCharacters) {
|
TEST_F(OptionsFileTest, SpecialCharacters) {
|
||||||
OptionsFile store(kTestFile);
|
|
||||||
// Clear contents of the file on disk.
|
// Clear contents of the file on disk.
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
std::string out;
|
std::string out;
|
||||||
EXPECT_FALSE(store.SetStringValue(kOptionWithEquals, kTestString1));
|
EXPECT_FALSE(store_->SetStringValue(kOptionWithEquals, kTestString1));
|
||||||
EXPECT_FALSE(store.GetStringValue(kOptionWithEquals, &out));
|
EXPECT_FALSE(store_->GetStringValue(kOptionWithEquals, &out));
|
||||||
EXPECT_FALSE(store.SetStringValue(kOptionWithNewline, kTestString1));
|
EXPECT_FALSE(store_->SetStringValue(kOptionWithNewline, kTestString1));
|
||||||
EXPECT_FALSE(store.GetStringValue(kOptionWithNewline, &out));
|
EXPECT_FALSE(store_->GetStringValue(kOptionWithNewline, &out));
|
||||||
EXPECT_TRUE(store.SetStringValue(kOptionWithUtf8, kValueWithUtf8));
|
EXPECT_TRUE(store_->SetStringValue(kOptionWithUtf8, kValueWithUtf8));
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kTestString1));
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kTestString1));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||||
EXPECT_EQ(kTestString1, out);
|
EXPECT_EQ(kTestString1, out);
|
||||||
EXPECT_TRUE(store.GetStringValue(kOptionWithUtf8, &out));
|
EXPECT_TRUE(store_->GetStringValue(kOptionWithUtf8, &out));
|
||||||
EXPECT_EQ(kValueWithUtf8, out);
|
EXPECT_EQ(kValueWithUtf8, out);
|
||||||
EXPECT_FALSE(store.SetStringValue(kTestOptionA, kValueWithNewline));
|
EXPECT_FALSE(store_->SetStringValue(kTestOptionA, kValueWithNewline));
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||||
EXPECT_EQ(kTestString1, out);
|
EXPECT_EQ(kTestString1, out);
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionA, kValueWithEquals));
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionA, kValueWithEquals));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionA, &out));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionA, &out));
|
||||||
EXPECT_EQ(kValueWithEquals, out);
|
EXPECT_EQ(kValueWithEquals, out);
|
||||||
EXPECT_TRUE(store.SetStringValue(kEmptyString, kTestString2));
|
EXPECT_TRUE(store_->SetStringValue(kEmptyString, kTestString2));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetStringValue(kEmptyString, &out));
|
EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out));
|
||||||
EXPECT_EQ(kTestString2, out);
|
EXPECT_EQ(kTestString2, out);
|
||||||
EXPECT_TRUE(store.SetStringValue(kTestOptionB, kEmptyString));
|
EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString));
|
||||||
EXPECT_TRUE(store.Save());
|
EXPECT_TRUE(store_->Save());
|
||||||
EXPECT_TRUE(store.Load());
|
EXPECT_TRUE(store_->Load());
|
||||||
EXPECT_TRUE(store.GetStringValue(kTestOptionB, &out));
|
EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out));
|
||||||
EXPECT_EQ(kEmptyString, out);
|
EXPECT_EQ(kEmptyString, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MaybeRemapSendError() {
|
void MaybeRemapSendError() {
|
||||||
#if defined(OSX)
|
#if defined(OSX) || defined(IOS)
|
||||||
// https://developer.apple.com/library/mac/documentation/Darwin/
|
// https://developer.apple.com/library/mac/documentation/Darwin/
|
||||||
// Reference/ManPages/man2/sendto.2.html
|
// Reference/ManPages/man2/sendto.2.html
|
||||||
// ENOBUFS - The output queue for a network interface is full.
|
// ENOBUFS - The output queue for a network interface is full.
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "talk/base/physicalsocketserver.h"
|
#include "talk/base/physicalsocketserver.h"
|
||||||
#include "talk/base/scoped_ptr.h"
|
#include "talk/base/scoped_ptr.h"
|
||||||
#include "talk/base/socket_unittest.h"
|
#include "talk/base/socket_unittest.h"
|
||||||
|
#include "talk/base/testutils.h"
|
||||||
#include "talk/base/thread.h"
|
#include "talk/base/thread.h"
|
||||||
|
|
||||||
namespace talk_base {
|
namespace talk_base {
|
||||||
@ -74,21 +75,11 @@ 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) {
|
TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv4) {
|
||||||
#endif
|
|
||||||
SocketTest::TestConnectWithClosedSocketIPv4();
|
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) {
|
TEST_F(PhysicalSocketTest, TestConnectWithClosedSocketIPv6) {
|
||||||
#endif
|
|
||||||
SocketTest::TestConnectWithClosedSocketIPv6();
|
SocketTest::TestConnectWithClosedSocketIPv6();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +218,7 @@ Thread *PosixSignalDeliveryTest::signaled_thread_ = NULL;
|
|||||||
// Test receiving a synchronous signal while not in Wait() and then entering
|
// Test receiving a synchronous signal while not in Wait() and then entering
|
||||||
// Wait() afterwards.
|
// Wait() afterwards.
|
||||||
TEST_F(PosixSignalDeliveryTest, RaiseThenWait) {
|
TEST_F(PosixSignalDeliveryTest, RaiseThenWait) {
|
||||||
ss_->SetPosixSignalHandler(SIGTERM, &RecordSignal);
|
ASSERT_TRUE(ss_->SetPosixSignalHandler(SIGTERM, &RecordSignal));
|
||||||
raise(SIGTERM);
|
raise(SIGTERM);
|
||||||
EXPECT_TRUE(ss_->Wait(0, true));
|
EXPECT_TRUE(ss_->Wait(0, true));
|
||||||
EXPECT_TRUE(ExpectSignal(SIGTERM));
|
EXPECT_TRUE(ExpectSignal(SIGTERM));
|
||||||
|
@ -172,8 +172,8 @@ void SocketTest::TestUdpIPv6() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SocketTest::TestUdpReadyToSendIPv4() {
|
void SocketTest::TestUdpReadyToSendIPv4() {
|
||||||
#if !defined(OSX)
|
#if !defined(OSX) && !defined(IOS)
|
||||||
// TODO(ronghuawu): Enable this test (currently failed on build bots) on mac.
|
// TODO(ronghuawu): Enable this test on mac/ios.
|
||||||
UdpReadyToSend(kIPv4Loopback);
|
UdpReadyToSend(kIPv4Loopback);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,15 @@
|
|||||||
#include "talk/base/stream.h"
|
#include "talk/base/stream.h"
|
||||||
#include "talk/base/stringutils.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 {
|
namespace talk_base {
|
||||||
|
|
||||||
#if !defined(ANDROID) && !defined(IOS)
|
#if !defined(ANDROID) && !defined(IOS)
|
||||||
@ -85,6 +94,17 @@ void UnixFilesystem::SetAppTempFolder(const std::string& folder) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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) {
|
bool UnixFilesystem::CreateFolder(const Pathname &path, mode_t mode) {
|
||||||
std::string pathname(path.pathname());
|
std::string pathname(path.pathname());
|
||||||
int len = pathname.length();
|
int len = pathname.length();
|
||||||
@ -369,6 +389,9 @@ bool UnixFilesystem::GetAppPathname(Pathname* path) {
|
|||||||
return success;
|
return success;
|
||||||
#elif defined(__native_client__)
|
#elif defined(__native_client__)
|
||||||
return false;
|
return false;
|
||||||
|
#elif IOS
|
||||||
|
IOSAppName(path);
|
||||||
|
return true;
|
||||||
#else // OSX
|
#else // OSX
|
||||||
char buffer[PATH_MAX + 2];
|
char buffer[PATH_MAX + 2];
|
||||||
ssize_t len = readlink("/proc/self/exe", buffer, ARRAY_SIZE(buffer) - 1);
|
ssize_t len = readlink("/proc/self/exe", buffer, ARRAY_SIZE(buffer) - 1);
|
||||||
@ -521,7 +544,7 @@ bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path, int64 *freebytes) {
|
|||||||
#endif // ANDROID
|
#endif // ANDROID
|
||||||
#if defined(LINUX) || defined(ANDROID)
|
#if defined(LINUX) || defined(ANDROID)
|
||||||
*freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail;
|
*freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail;
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(IOS)
|
||||||
*freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail;
|
*freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,13 +36,17 @@ namespace talk_base {
|
|||||||
|
|
||||||
class UnixFilesystem : public FilesystemInterface {
|
class UnixFilesystem : public FilesystemInterface {
|
||||||
public:
|
public:
|
||||||
|
UnixFilesystem();
|
||||||
|
virtual ~UnixFilesystem();
|
||||||
|
|
||||||
#if defined(ANDROID) || defined(IOS)
|
#if defined(ANDROID) || defined(IOS)
|
||||||
// Android does not have a native code API to fetch the app data or temp
|
// 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
|
// 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
|
// only supports an Objective-C API for fetching the folder locations, so that
|
||||||
// needs to be passed in here from Objective-C.
|
// 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.
|
||||||
static void SetAppDataFolder(const std::string& folder);
|
static void SetAppDataFolder(const std::string& folder);
|
||||||
static void SetAppTempFolder(const std::string& folder);
|
static void SetAppTempFolder(const std::string& folder);
|
||||||
#endif
|
#endif
|
||||||
|
24
talk/build/ios_test.plist
Normal file
24
talk/build/ios_test.plist
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?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>
|
55
talk/build/ios_tests.gypi
Normal file
55
talk/build/ios_tests.gypi
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# 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,6 +657,7 @@
|
|||||||
}],
|
}],
|
||||||
['OS=="ios"', {
|
['OS=="ios"', {
|
||||||
'sources': [
|
'sources': [
|
||||||
|
'base/iosfilesystem.mm',
|
||||||
'base/scoped_autorelease_pool.mm',
|
'base/scoped_autorelease_pool.mm',
|
||||||
],
|
],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
{
|
{
|
||||||
'target_name': 'libjingle_unittest',
|
'target_name': 'libjingle_unittest',
|
||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
|
'includes': [ 'build/ios_tests.gypi', ],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'gunit',
|
'gunit',
|
||||||
'libjingle.gyp:libjingle',
|
'libjingle.gyp:libjingle',
|
||||||
@ -492,51 +493,27 @@
|
|||||||
# does just fine on 10.6 too).
|
# does just fine on 10.6 too).
|
||||||
'targets': [
|
'targets': [
|
||||||
{
|
{
|
||||||
'target_name': 'libjingle_peerconnection_objc_test',
|
'target_name': 'libjingle_peerconnection_objc_test',
|
||||||
'variables': {
|
|
||||||
'infoplist_file': './app/webrtc/objctests/Info.plist',
|
|
||||||
},
|
|
||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'mac_bundle': 1,
|
'includes': [ 'build/ios_tests.gypi', ],
|
||||||
'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': [
|
'dependencies': [
|
||||||
'gunit',
|
'gunit',
|
||||||
'libjingle.gyp:libjingle_peerconnection_objc',
|
'libjingle.gyp:libjingle_peerconnection_objc',
|
||||||
],
|
],
|
||||||
'FRAMEWORK_SEARCH_PATHS': [
|
|
||||||
'$(inherited)',
|
|
||||||
'$(SDKROOT)/Developer/Library/Frameworks',
|
|
||||||
'$(DEVELOPER_LIBRARY_DIR)/Frameworks',
|
|
||||||
],
|
|
||||||
'sources': [
|
'sources': [
|
||||||
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.h',
|
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.h',
|
||||||
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.m',
|
'app/webrtc/objctests/RTCPeerConnectionSyncObserver.m',
|
||||||
'app/webrtc/objctests/RTCPeerConnectionTest.mm',
|
'app/webrtc/objctests/RTCPeerConnectionTest.mm',
|
||||||
'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h',
|
'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h',
|
||||||
'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m',
|
'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',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'FRAMEWORK_SEARCH_PATHS': [
|
||||||
['OS=="mac" or OS=="ios"', {
|
'$(inherited)',
|
||||||
'sources': [
|
'$(SDKROOT)/Developer/Library/Frameworks',
|
||||||
# TODO(fischman): figure out if this works for ios or if it
|
'$(DEVELOPER_LIBRARY_DIR)/Frameworks',
|
||||||
# needs a GUI driver.
|
|
||||||
'app/webrtc/objctests/mac/main.mm',
|
|
||||||
],
|
|
||||||
}],
|
|
||||||
],
|
],
|
||||||
}, # target libjingle_peerconnection_objc_test
|
}, # target libjingle_peerconnection_objc_test
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user