summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/c/DEPS11
-rw-r--r--ppapi/cpp/DEPS16
-rw-r--r--ppapi/cpp/file_io.cc1
-rw-r--r--ppapi/cpp/private/DEPS3
-rw-r--r--ppapi/cpp/trusted/DEPS5
-rw-r--r--ppapi/tests/DEPS13
-rw-r--r--ppapi/tests/pp_thread.h23
-rw-r--r--ppapi/tests/test_audio_config.cc7
-rw-r--r--ppapi/tests/test_file_io.cc21
-rw-r--r--ppapi/tests/test_flash.cc4
-rw-r--r--ppapi/tests/test_net_address_private.cc11
-rw-r--r--ppapi/tests/test_tcp_socket_private.cc1
-rw-r--r--ppapi/tests/test_transport.cc27
-rw-r--r--ppapi/tests/test_transport.h13
-rw-r--r--ppapi/tests/test_utils.h46
-rw-r--r--ppapi/tests/test_var.cc3
-rw-r--r--ppapi/tests/test_var_deprecated.cc3
-rw-r--r--ppapi/tests/test_websocket.cc1
18 files changed, 151 insertions, 58 deletions
diff --git a/ppapi/c/DEPS b/ppapi/c/DEPS
new file mode 100644
index 0000000..aa6e7d0
--- /dev/null
+++ b/ppapi/c/DEPS
@@ -0,0 +1,11 @@
+# ppapi/c should not be dependent on other parts of chromium; it should stay
+# browser-neutral as much as possible.
+include_rules = [
+ "-base",
+ "-build",
+ "-ipc",
+ "-uncode",
+ "-testing",
+ "-ppapi",
+ "+ppapi/c",
+]
diff --git a/ppapi/cpp/DEPS b/ppapi/cpp/DEPS
new file mode 100644
index 0000000..af2aa4c
--- /dev/null
+++ b/ppapi/cpp/DEPS
@@ -0,0 +1,16 @@
+# ppapi/cpp should not be dependent on other parts of chromium; it should stay
+# browser-neutral as much as possible.
+include_rules = [
+ "-base",
+ "-build",
+ "-ipc",
+ "-uncode",
+ "-testing",
+ "-ppapi",
+ "+ppapi/c",
+ "-ppapi/c/private",
+ "-ppapi/c/trusted",
+ "+ppapi/cpp",
+ "-ppapi/cpp/private",
+ "-ppapi/cpp/trusted",
+]
diff --git a/ppapi/cpp/file_io.cc b/ppapi/cpp/file_io.cc
index 85c3051..09354d5 100644
--- a/ppapi/cpp/file_io.cc
+++ b/ppapi/cpp/file_io.cc
@@ -6,7 +6,6 @@
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/instance.h"
diff --git a/ppapi/cpp/private/DEPS b/ppapi/cpp/private/DEPS
new file mode 100644
index 0000000..f11fdd6
--- /dev/null
+++ b/ppapi/cpp/private/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+ppapi/c/private",
+]
diff --git a/ppapi/cpp/trusted/DEPS b/ppapi/cpp/trusted/DEPS
new file mode 100644
index 0000000..52d9c47
--- /dev/null
+++ b/ppapi/cpp/trusted/DEPS
@@ -0,0 +1,5 @@
+include_rules = [
+ "+ppapi/c/private",
+ "+ppapi/c/trusted",
+ "+ppapi/cpp/private",
+]
diff --git a/ppapi/tests/DEPS b/ppapi/tests/DEPS
index 557b432..d679198 100644
--- a/ppapi/tests/DEPS
+++ b/ppapi/tests/DEPS
@@ -1,3 +1,16 @@
+# ppapi/tests should not be dependent on other parts of chromium; it should stay
+# browser-neutral as much as possible.
+include_rules = [
+ "-base",
+ "-build",
+ "-ipc",
+ "-uncode",
+ "-testing",
+ "-ppapi",
+ "+ppapi/c",
+ "+ppapi/cpp",
+ "+ppapi/tests",
+]
# checkdeps.py shouldn't check include paths for files in clang, which aren't
# part of the chrome build.
skip_child_includes = [
diff --git a/ppapi/tests/pp_thread.h b/ppapi/tests/pp_thread.h
index f168d8c..c4af8f1 100644
--- a/ppapi/tests/pp_thread.h
+++ b/ppapi/tests/pp_thread.h
@@ -7,20 +7,15 @@
#define PPAPI_TESTS_PP_THREAD_H_
#include "ppapi/c/pp_macros.h"
+#include "ppapi/tests/test_utils.h"
-/* These precompiler names were copied from chromium's build_config.h. */
-#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
- defined(__OpenBSD__) || defined(__sun) || defined(__native_client__)
-#define PPAPI_HAS_POSIX_THREADS 1
-#elif defined (_MSC_VER)
-#define PPAPI_HAS_WINDOWS_THREADS 1
-#endif
-
-#if defined(PPAPI_HAS_POSIX_THREADS)
+#if defined(PPAPI_POSIX)
#include <pthread.h>
-#elif defined(PPAPI_HAS_WINDOWS_THREADS)
+#elif defined(PPAPI_OS_WIN)
#include <process.h>
#include <windows.h>
+#else
+#error No thread library detected.
#endif
/**
@@ -38,9 +33,9 @@
* used in ppapi/tests, so is not part of the published API.
*/
-#if defined(PPAPI_HAS_POSIX_THREADS)
+#if defined(PPAPI_POSIX)
typedef pthread_t PP_ThreadType;
-#elif defined(PPAPI_HAS_WINDOWS_THREADS)
+#elif defined(PPAPI_OS_WIN)
typedef uintptr_t PP_ThreadType;
#endif
@@ -51,7 +46,7 @@ PP_INLINE bool PP_CreateThread(PP_ThreadType* thread,
void* thread_arg);
PP_INLINE void PP_JoinThread(PP_ThreadType thread);
-#if defined(PPAPI_HAS_POSIX_THREADS)
+#if defined(PPAPI_POSIX)
/* Because POSIX thread functions return void* and Windows thread functions do
* not, we make PPAPI thread functions have the least capability (no returns).
* This struct wraps the user data & function so that we can use the correct
@@ -88,7 +83,7 @@ PP_INLINE void PP_JoinThread(PP_ThreadType thread) {
pthread_join(thread, &exit_status);
}
-#elif defined(PPAPI_HAS_WINDOWS_THREADS)
+#elif defined(PPAPI_OS_WIN)
typedef DWORD (PP_WindowsThreadFunction)(void* data);
PP_INLINE bool PP_CreateThread(PP_ThreadType* thread,
diff --git a/ppapi/tests/test_audio_config.cc b/ppapi/tests/test_audio_config.cc
index 650e313..003d3e0 100644
--- a/ppapi/tests/test_audio_config.cc
+++ b/ppapi/tests/test_audio_config.cc
@@ -4,7 +4,6 @@
#include "ppapi/tests/test_audio_config.h"
-#include "base/basictypes.h" // For |arraysize()|.
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/cpp/module.h"
#include "ppapi/tests/testing_instance.h"
@@ -38,10 +37,12 @@ std::string TestAudioConfig::TestValidConfigs() {
4096
};
- for (size_t i = 0; i < arraysize(kSampleRates); i++) {
+ for (size_t i = 0; i < sizeof(kSampleRates)/sizeof(kSampleRates[0]); i++) {
PP_AudioSampleRate sample_rate = kSampleRates[i];
- for (size_t j = 0; j < arraysize(kRequestFrameCounts); j++) {
+ for (size_t j = 0;
+ j < sizeof(kRequestFrameCounts)/sizeof(kRequestFrameCounts);
+ j++) {
uint32_t request_frame_count = kRequestFrameCounts[j];
ASSERT_TRUE(request_frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT);
ASSERT_TRUE(request_frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT);
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index 79995ff..b04c7e9 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -6,7 +6,8 @@
#include <string.h>
-#include "base/memory/scoped_ptr.h"
+#include <vector>
+
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
@@ -697,19 +698,17 @@ std::string TestFileIO::TestParallelReads() {
TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
int32_t read_offset_1 = 0;
int32_t size_1 = 3;
- char* extended_buf_1 = new char[border_size * 2 + size_1];
- scoped_array<char> extended_buf_1_deleter(extended_buf_1);
- char* buf_1 = extended_buf_1 + border_size;
- memcpy(extended_buf_1, border, border_size);
+ std::vector<char> extended_buf_1(border_size * 2 + size_1);
+ char* buf_1 = &extended_buf_1[border_size];
+ memcpy(&extended_buf_1[0], border, border_size);
memcpy(buf_1 + size_1, border, border_size);
TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
int32_t read_offset_2 = size_1;
int32_t size_2 = 9;
- char* extended_buf_2 = new char[border_size * 2 + size_2];
- scoped_array<char> extended_buf_2_deleter(extended_buf_2);
- char* buf_2 = extended_buf_2 + border_size;
- memcpy(extended_buf_2, border, border_size);
+ std::vector<char> extended_buf_2(border_size * 2 + size_2);
+ char* buf_2 = &extended_buf_2[border_size];
+ memcpy(&extended_buf_2[0], border, border_size);
memcpy(buf_2 + size_2, border, border_size);
int32_t rv_1 = PP_OK;
@@ -756,9 +755,9 @@ std::string TestFileIO::TestParallelReads() {
// Make sure every read operation writes into the correct buffer.
const char expected_result_1[] = "__border__abc__border__";
const char expected_result_2[] = "__border__defghijkl__border__";
- if (strncmp(extended_buf_1, expected_result_1,
+ if (strncmp(&extended_buf_1[0], expected_result_1,
strlen(expected_result_1)) != 0 ||
- strncmp(extended_buf_2, expected_result_2,
+ strncmp(&extended_buf_2[0], expected_result_2,
strlen(expected_result_2)) != 0) {
return std::string(
"Parallel FileIO::Read operations have written into wrong buffers.");
diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc
index d7ac95a..2121325 100644
--- a/ppapi/tests/test_flash.cc
+++ b/ppapi/tests/test_flash.cc
@@ -4,11 +4,11 @@
#include "ppapi/tests/test_flash.h"
-#include "base/compiler_specific.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/var.h"
+#include "ppapi/tests/test_utils.h"
#include "ppapi/tests/testing_instance.h"
REGISTER_TEST_CASE(Flash);
@@ -17,7 +17,7 @@ using pp::Var;
TestFlash::TestFlash(TestingInstance* instance)
: TestCase(instance),
- ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
+ PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {
}
bool TestFlash::Init() {
diff --git a/ppapi/tests/test_net_address_private.cc b/ppapi/tests/test_net_address_private.cc
index 8e90bf2..3860617 100644
--- a/ppapi/tests/test_net_address_private.cc
+++ b/ppapi/tests/test_net_address_private.cc
@@ -4,29 +4,28 @@
#include "ppapi/tests/test_net_address_private.h"
-#include "base/basictypes.h"
-#include "build/build_config.h"
#include "ppapi/cpp/private/net_address_private.h"
#include "ppapi/c/private/ppb_net_address_private.h"
+#include "ppapi/tests/test_utils.h"
#include "ppapi/tests/testing_instance.h"
// Other than |GetAnyAddress()|, there's no way to actually get
// |PP_NetAddress_Private| structs from just this interface. We'll cheat and
// synthesize some.
-#if defined(OS_POSIX)
+#if defined(PPAPI_POSIX)
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif
-#if defined(OS_MACOSX)
+#if defined(PPAPI_OS_MACOSX)
// This is a bit evil, but it's standard operating procedure for |s6_addr|....
#define s6_addr16 __u6_addr.__u6_addr16
#endif
-#if defined(OS_WIN)
+#if defined(PPAPI_OS_WIN)
#include <ws2tcpip.h>
#define s6_addr16 u.Word
@@ -233,7 +232,7 @@ std::string TestNetAddressPrivate::TestDescribeIPv6() {
}
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) {
+ for (size_t i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); i++) {
PP_NetAddress_Private addr = MakeIPv6NetAddress(test_cases[i].address,
test_cases[i].port,
test_cases[i].scope);
diff --git a/ppapi/tests/test_tcp_socket_private.cc b/ppapi/tests/test_tcp_socket_private.cc
index d7a6a3f..1de1fa8 100644
--- a/ppapi/tests/test_tcp_socket_private.cc
+++ b/ppapi/tests/test_tcp_socket_private.cc
@@ -6,7 +6,6 @@
#include <stdlib.h>
-#include "base/string_split.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/cpp/dev/url_util_dev.h"
#include "ppapi/cpp/private/tcp_socket_private.h"
diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc
index 5826f35..311cf9d 100644
--- a/ppapi/tests/test_transport.cc
+++ b/ppapi/tests/test_transport.cc
@@ -40,7 +40,7 @@ class StreamReader {
pp::CompletionCallback done_callback)
: expected_size_(expected_size),
done_callback_(done_callback),
- ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
+ PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
transport_(transport),
received_size_(0) {
Read();
@@ -96,6 +96,11 @@ class StreamReader {
} // namespace
+TestTransport::~TestTransport() {
+ delete transport1_;
+ delete transport2_;
+}
+
bool TestTransport::Init() {
transport_interface_ = reinterpret_cast<PPB_Transport_Dev const*>(
pp::Module::Get()->GetBrowserInterface(PPB_TRANSPORT_DEV_INTERFACE));
@@ -113,11 +118,11 @@ void TestTransport::RunTests(const std::string& filter) {
}
std::string TestTransport::InitTargets(PP_TransportType type) {
- transport1_.reset(new pp::Transport_Dev(instance_, kTestChannelName, type));
- transport2_.reset(new pp::Transport_Dev(instance_, kTestChannelName, type));
+ transport1_ = new pp::Transport_Dev(instance_, kTestChannelName, type);
+ transport2_ = new pp::Transport_Dev(instance_, kTestChannelName, type);
- ASSERT_TRUE(transport1_.get() != NULL);
- ASSERT_TRUE(transport2_.get() != NULL);
+ ASSERT_NE(NULL, transport1_);
+ ASSERT_NE(NULL, transport2_);
PASS();
}
@@ -155,8 +160,10 @@ std::string TestTransport::Connect() {
}
std::string TestTransport::Clean() {
- transport1_.reset();
- transport2_.reset();
+ delete transport1_;
+ transport1_ = NULL;
+ delete transport2_;
+ transport2_ = NULL;
PASS();
}
@@ -241,8 +248,7 @@ std::string TestTransport::TestSendDataUdp() {
const int kUdpWaitTimeMs = 1000; // 1 second.
TestCompletionCallback done_cb(instance_->pp_instance());
- StreamReader reader(transport1_.get(), kSendBufferSize * kNumPackets,
- done_cb);
+ StreamReader reader(transport1_, kSendBufferSize * kNumPackets, done_cb);
std::map<int, std::vector<char> > sent_packets;
for (int i = 0; i < kNumPackets; ++i) {
@@ -293,8 +299,7 @@ std::string TestTransport::TestSendDataTcp() {
const int kTcpSendSize = 100000;
TestCompletionCallback done_cb(instance_->pp_instance());
- StreamReader reader(transport1_.get(), kTcpSendSize,
- done_cb);
+ StreamReader reader(transport1_, kTcpSendSize, done_cb);
std::vector<char> send_buffer(kTcpSendSize);
for (size_t j = 0; j < send_buffer.size(); ++j) {
diff --git a/ppapi/tests/test_transport.h b/ppapi/tests/test_transport.h
index 7454232..4377515 100644
--- a/ppapi/tests/test_transport.h
+++ b/ppapi/tests/test_transport.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/tests/test_case.h"
@@ -19,7 +18,13 @@ class Transport_Dev;
class TestTransport : public TestCase {
public:
- explicit TestTransport(TestingInstance* instance) : TestCase(instance) {}
+ explicit TestTransport(TestingInstance* instance)
+ : TestCase(instance),
+ transport1_(NULL),
+ transport2_(NULL) {
+ }
+ virtual ~TestTransport();
+
// TestCase implementation.
virtual bool Init();
@@ -41,8 +46,8 @@ class TestTransport : public TestCase {
// Used by the tests that access the C API directly.
const PPB_Transport_Dev* transport_interface_;
- scoped_ptr<pp::Transport_Dev> transport1_;
- scoped_ptr<pp::Transport_Dev> transport2_;
+ pp::Transport_Dev* transport1_;
+ pp::Transport_Dev* transport2_;
};
#endif // PPAPI_TESTS_TEST_TRANSPORT_H_
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h
index a7996b6..c2d9207 100644
--- a/ppapi/tests/test_utils.h
+++ b/ppapi/tests/test_utils.h
@@ -49,4 +49,50 @@ class TestCompletionCallback {
PP_Instance instance_;
};
+/*
+ * A set of macros to use for platform detection. These were largely copied
+ * from chromium's build_config.h.
+ */
+#if defined(__APPLE__)
+#define PPAPI_OS_MACOSX 1
+#elif defined(ANDROID)
+#define PPAPI_OS_ANDROID 1
+#elif defined(__native_client__)
+#define PPAPI_OS_NACL 1
+#elif defined(__linux__)
+#define PPAPI_OS_LINUX 1
+#elif defined(_WIN32)
+#define PPAPI_OS_WIN 1
+#elif defined(__FreeBSD__)
+#define PPAPI_OS_FREEBSD 1
+#elif defined(__OpenBSD__)
+#define PPAPI_OS_OPENBSD 1
+#elif defined(__sun)
+#define PPAPI_OS_SOLARIS 1
+#else
+#error Please add support for your platform in ppapi/c/pp_macros.h.
+#endif
+
+/* These are used to determine POSIX-like implementations vs Windows. */
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
+ defined(__OpenBSD__) || defined(__sun) || defined(__native_client__)
+#define PPAPI_POSIX 1
+#endif
+
+// This is roughly copied from base/compiler_specific.h, and makes it possible
+// to pass 'this' in a constructor initializer list, when you really mean it.
+//
+// Example usage:
+// Foo::Foo(MyInstance* instance)
+// : ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {}
+#if defined(COMPILER_MSVC)
+#define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4355)) \
+ code \
+ __pragma(warning(pop))
+#else
+#define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) code
+#endif
+
#endif // PPAPI_TESTS_TEST_UTILS_H_
diff --git a/ppapi/tests/test_var.cc b/ppapi/tests/test_var.cc
index 6357737..ff899a0 100644
--- a/ppapi/tests/test_var.cc
+++ b/ppapi/tests/test_var.cc
@@ -8,7 +8,6 @@
#include <limits>
-#include "base/basictypes.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_var.h"
@@ -46,7 +45,7 @@ std::string TestVar::TestBasicString() {
instance_->pp_instance());
{
const char kStr[] = "Hello";
- const uint32_t kStrLen(arraysize(kStr) - 1);
+ const uint32_t kStrLen(sizeof(kStr) - 1);
PP_Var str = var_interface_->VarFromUtf8(pp::Module::Get()->pp_module(),
kStr, kStrLen);
ASSERT_EQ(PP_VARTYPE_STRING, str.type);
diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc
index 66ef23a..00585e6 100644
--- a/ppapi/tests/test_var_deprecated.cc
+++ b/ppapi/tests/test_var_deprecated.cc
@@ -8,7 +8,6 @@
#include <limits>
-#include "base/basictypes.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
@@ -94,7 +93,7 @@ std::string TestVarDeprecated::TestBasicString() {
instance_->pp_instance());
{
const char kStr[] = "Hello";
- const uint32_t kStrLen(arraysize(kStr) - 1);
+ const uint32_t kStrLen(sizeof(kStr) - 1);
PP_Var str = var_interface_->VarFromUtf8(pp::Module::Get()->pp_module(),
kStr, kStrLen);
ASSERT_EQ(PP_VARTYPE_STRING, str.type);
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
index 8f55889..ac1e1db 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -6,7 +6,6 @@
#include <string.h>
-#include "base/logging.h"
#include "ppapi/c/dev/ppb_websocket_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_var.h"