summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-12 06:19:03 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-12 06:19:03 +0000
commit0b438a6cb14afd1ba84cb27156ee4d5b64de2d16 (patch)
tree2d741ac6239cc6ea96b6e18c871052265a787a45 /mojo
parent9b23bd4cdf20ad2e3bd7a9645ce7c79279f36c71 (diff)
downloadchromium_src-0b438a6cb14afd1ba84cb27156ee4d5b64de2d16.zip
chromium_src-0b438a6cb14afd1ba84cb27156ee4d5b64de2d16.tar.gz
chromium_src-0b438a6cb14afd1ba84cb27156ee4d5b64de2d16.tar.bz2
Mojo: re-organize public tests
Move sample service test to be with the rest of the bindings tests, and change it to not echo output by default. R=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/134823005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/common/common_type_converters_unittest.cc14
-rw-r--r--mojo/mojo.gyp8
-rw-r--r--mojo/mojo_public.gypi99
-rw-r--r--mojo/public/tests/DEPS4
-rw-r--r--mojo/public/tests/bindings/DEPS4
-rw-r--r--mojo/public/tests/bindings/array_unittest.cc (renamed from mojo/public/tests/bindings_array_unittest.cc)8
-rw-r--r--mojo/public/tests/bindings/buffer_unittest.cc (renamed from mojo/public/tests/buffer_unittest.cc)2
-rw-r--r--mojo/public/tests/bindings/connector_unittest.cc (renamed from mojo/public/tests/bindings_connector_unittest.cc)16
-rw-r--r--mojo/public/tests/bindings/handle_passing_unittest.cc (renamed from mojo/public/tests/bindings_handle_passing_unittest.cc)2
-rw-r--r--mojo/public/tests/bindings/math_calculator.mojom (renamed from mojo/public/tests/math_calculator.mojom)0
-rw-r--r--mojo/public/tests/bindings/remote_ptr_unittest.cc (renamed from mojo/public/tests/bindings_remote_ptr_unittest.cc)16
-rw-r--r--mojo/public/tests/bindings/sample_factory.mojom (renamed from mojo/public/tests/sample_factory.mojom)0
-rw-r--r--mojo/public/tests/bindings/sample_service.mojom (renamed from mojo/public/bindings/sample/sample_service.mojom)0
-rw-r--r--mojo/public/tests/bindings/sample_service_unittests.cc (renamed from mojo/public/bindings/sample/sample_service_unittests.cc)49
-rw-r--r--mojo/public/tests/bindings/simple_bindings_support.cc (renamed from mojo/public/tests/simple_bindings_support.cc)2
-rw-r--r--mojo/public/tests/bindings/simple_bindings_support.h (renamed from mojo/public/tests/simple_bindings_support.h)0
-rw-r--r--mojo/public/tests/bindings/test_structs.mojom (renamed from mojo/public/tests/test_structs.mojom)0
-rw-r--r--mojo/public/tests/bindings/type_conversion_unittest.cc (renamed from mojo/public/tests/bindings_type_conversion_unittest.cc)22
-rw-r--r--mojo/public/tests/system/DEPS3
-rw-r--r--mojo/public/tests/system/core_cpp_unittest.cc (renamed from mojo/public/tests/system_core_cpp_unittest.cc)0
-rw-r--r--mojo/public/tests/system/core_perftest.cc (renamed from mojo/public/tests/system_core_perftest.cc)30
-rw-r--r--mojo/public/tests/system/core_unittest.cc (renamed from mojo/public/tests/system_core_unittest.cc)4
-rw-r--r--mojo/public/tests/utility/bindings_support_impl_unittest.cc (renamed from mojo/public/utility/bindings_support_impl_unittest.cc)0
-rw-r--r--mojo/public/tests/utility/run_loop_unittest.cc (renamed from mojo/public/utility/run_loop_unittest.cc)0
-rw-r--r--mojo/public/tests/utility/thread_local_unittest.cc (renamed from mojo/public/utility/thread_local_unittest.cc)0
-rw-r--r--mojo/public/utility/DEPS11
-rw-r--r--mojo/public/utility/thread_local.h8
-rwxr-xr-xmojo/tools/mojob.sh7
28 files changed, 161 insertions, 148 deletions
diff --git a/mojo/common/common_type_converters_unittest.cc b/mojo/common/common_type_converters_unittest.cc
index 96a814e9..90649fd 100644
--- a/mojo/common/common_type_converters_unittest.cc
+++ b/mojo/common/common_type_converters_unittest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/common/bindings_support_impl.h"
#include "mojo/common/common_type_converters.h"
-#include "mojo/public/tests/simple_bindings_support.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
+namespace common {
namespace test {
namespace {
@@ -24,7 +25,15 @@ void ExpectEqualsMojoString(const std::string& expected,
class CommonTypeConvertersTest : public testing::Test {
private:
- SimpleBindingsSupport bindings_support_;
+ virtual void SetUp() OVERRIDE {
+ BindingsSupport::Set(&bindings_support_);
+ }
+
+ virtual void TearDown() OVERRIDE {
+ BindingsSupport::Set(NULL);
+ }
+
+ BindingsSupportImpl bindings_support_;
};
TEST_F(CommonTypeConvertersTest, StringPiece) {
@@ -48,4 +57,5 @@ TEST_F(CommonTypeConvertersTest, StringPiece) {
}
} // namespace test
+} // namespace common
} // namespace mojo
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp
index 08e4864..5c6568b 100644
--- a/mojo/mojo.gyp
+++ b/mojo/mojo.gyp
@@ -18,14 +18,15 @@
'type': 'none',
'dependencies': [
'mojo_bindings',
- 'mojo_bindings_unittests',
'mojo_common_lib',
'mojo_common_unittests',
'mojo_js',
'mojo_js_unittests',
- 'mojo_public_perftests',
'mojo_public_test_support',
- 'mojo_public_unittests',
+ 'mojo_public_bindings_unittests',
+ 'mojo_public_system_perftests',
+ 'mojo_public_system_unittests',
+ 'mojo_public_utility_unittests',
'mojo_sample_app',
'mojo_shell',
'mojo_shell_lib',
@@ -34,7 +35,6 @@
'mojo_system_impl',
'mojo_system_unittests',
'mojo_utility',
- 'mojo_utility_unittests',
],
'conditions': [
['use_aura==1', {
diff --git a/mojo/mojo_public.gypi b/mojo/mojo_public.gypi
index 2a106f6..488f373 100644
--- a/mojo/mojo_public.gypi
+++ b/mojo/mojo_public.gypi
@@ -32,39 +32,73 @@
'mojo_system',
],
'sources': [
- 'public/tests/simple_bindings_support.cc',
- 'public/tests/simple_bindings_support.h',
'public/tests/test_support.cc',
'public/tests/test_support.h',
],
},
{
- 'target_name': 'mojo_public_unittests',
+ 'target_name': 'mojo_public_bindings_unittests',
'type': 'executable',
'dependencies': [
'../testing/gtest.gyp:gtest',
'mojo_bindings',
'mojo_public_test_support',
'mojo_run_all_unittests',
+ 'mojo_sample_service',
'mojo_system',
],
'sources': [
- 'public/tests/bindings_array_unittest.cc',
- 'public/tests/bindings_connector_unittest.cc',
- 'public/tests/bindings_handle_passing_unittest.cc',
- 'public/tests/bindings_remote_ptr_unittest.cc',
- 'public/tests/bindings_type_conversion_unittest.cc',
- 'public/tests/buffer_unittest.cc',
- 'public/tests/math_calculator.mojom',
- 'public/tests/sample_factory.mojom',
- 'public/tests/system_core_cpp_unittest.cc',
- 'public/tests/system_core_unittest.cc',
- 'public/tests/test_structs.mojom',
+ 'public/tests/bindings/array_unittest.cc',
+ 'public/tests/bindings/connector_unittest.cc',
+ 'public/tests/bindings/handle_passing_unittest.cc',
+ 'public/tests/bindings/remote_ptr_unittest.cc',
+ 'public/tests/bindings/type_conversion_unittest.cc',
+ 'public/tests/bindings/buffer_unittest.cc',
+ 'public/tests/bindings/math_calculator.mojom',
+ 'public/tests/bindings/sample_factory.mojom',
+ 'public/tests/bindings/sample_service_unittests.cc',
+ 'public/tests/bindings/simple_bindings_support.cc',
+ 'public/tests/bindings/simple_bindings_support.h',
+ 'public/tests/bindings/test_structs.mojom',
],
'includes': [ 'public/bindings/mojom_bindings_generator.gypi' ],
},
{
- 'target_name': 'mojo_public_perftests',
+ 'target_name': 'mojo_public_system_unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../testing/gtest.gyp:gtest',
+ 'mojo_bindings',
+ 'mojo_public_test_support',
+ 'mojo_run_all_unittests',
+ 'mojo_system',
+ ],
+ 'sources': [
+ 'public/tests/system/core_cpp_unittest.cc',
+ 'public/tests/system/core_unittest.cc',
+ ],
+ },
+ {
+ 'target_name': 'mojo_public_utility_unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../testing/gtest.gyp:gtest',
+ 'mojo_bindings',
+ 'mojo_public_test_support',
+ 'mojo_run_all_unittests',
+ 'mojo_system',
+ 'mojo_utility',
+ ],
+ 'sources': [
+ 'public/tests/utility/bindings_support_impl_unittest.cc',
+ 'public/tests/utility/run_loop_unittest.cc',
+ 'public/tests/utility/thread_local_unittest.cc',
+ ],
+ },
+ {
+ 'target_name': 'mojo_public_system_perftests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
@@ -74,7 +108,7 @@
'mojo_system',
],
'sources': [
- 'public/tests/system_core_perftest.cc',
+ 'public/tests/system/core_perftest.cc',
],
},
{
@@ -110,7 +144,7 @@
'target_name': 'mojo_sample_service',
'type': 'static_library',
'sources': [
- 'public/bindings/sample/sample_service.mojom',
+ 'public/tests/bindings/sample_service.mojom',
],
'includes': [ 'public/bindings/mojom_bindings_generator.gypi' ],
'export_dependent_settings': [
@@ -119,19 +153,6 @@
],
},
{
- 'target_name': 'mojo_bindings_unittests',
- 'type': 'executable',
- 'sources': [
- 'public/bindings/sample/sample_service_unittests.cc',
- ],
- 'dependencies': [
- '../testing/gtest.gyp:gtest',
- 'mojo_public_test_support',
- 'mojo_run_all_unittests',
- 'mojo_sample_service',
- ],
- },
- {
'target_name': 'mojo_utility',
'type': 'static_library',
'sources': [
@@ -150,23 +171,5 @@
'..',
],
},
- {
- 'target_name': 'mojo_utility_unittests',
- 'type': 'executable',
- 'dependencies': [
- '../base/base.gyp:base',
- '../testing/gtest.gyp:gtest',
- 'mojo_bindings',
- 'mojo_public_test_support',
- 'mojo_run_all_unittests',
- 'mojo_system',
- 'mojo_utility',
- ],
- 'sources': [
- 'public/utility/bindings_support_impl_unittest.cc',
- 'public/utility/run_loop_unittest.cc',
- 'public/utility/thread_local_unittest.cc',
- ],
- },
],
}
diff --git a/mojo/public/tests/DEPS b/mojo/public/tests/DEPS
index 318b722..4b6a853 100644
--- a/mojo/public/tests/DEPS
+++ b/mojo/public/tests/DEPS
@@ -1,7 +1,5 @@
-# TODO(darin): Move this folder out of mojo/public/.
+# TODO(darin): Eliminate the base dependency!
include_rules = [
"+base",
- "+build",
"+mojo",
- "+testing",
]
diff --git a/mojo/public/tests/bindings/DEPS b/mojo/public/tests/bindings/DEPS
new file mode 100644
index 0000000..eac29ee
--- /dev/null
+++ b/mojo/public/tests/bindings/DEPS
@@ -0,0 +1,4 @@
+include_rules = [
+ "-base",
+ "+testing",
+]
diff --git a/mojo/public/tests/bindings_array_unittest.cc b/mojo/public/tests/bindings/array_unittest.cc
index 7a776b0..bb46c67 100644
--- a/mojo/public/tests/bindings_array_unittest.cc
+++ b/mojo/public/tests/bindings/array_unittest.cc
@@ -3,14 +3,14 @@
// found in the LICENSE file.
#include "mojo/public/bindings/lib/array.h"
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace test {
// Tests that basic Array operations work.
-TEST(BindingsArrayTest, Basic) {
+TEST(ArrayTest, Basic) {
SimpleBindingsSupport bindings_support;
// 8 bytes for the array, with 8 bytes left over for elements.
@@ -33,7 +33,7 @@ TEST(BindingsArrayTest, Basic) {
// Tests that basic Array<bool> operations work, and that it's packed into 1
// bit per element.
-TEST(BindingsArrayTest, Bool) {
+TEST(ArrayTest, Bool) {
SimpleBindingsSupport bindings_support;
// 8 bytes for the array header, with 8 bytes left over for elements.
@@ -56,7 +56,7 @@ TEST(BindingsArrayTest, Bool) {
}
// Tests that Array<Handle> supports transferring handles.
-TEST(BindingsArrayTest, Handle) {
+TEST(ArrayTest, Handle) {
SimpleBindingsSupport bindings_support;
AllocationScope scope;
diff --git a/mojo/public/tests/buffer_unittest.cc b/mojo/public/tests/bindings/buffer_unittest.cc
index c97dc98..ab181505 100644
--- a/mojo/public/tests/buffer_unittest.cc
+++ b/mojo/public/tests/bindings/buffer_unittest.cc
@@ -4,7 +4,7 @@
#include "mojo/public/bindings/lib/bindings_serialization.h"
#include "mojo/public/bindings/lib/buffer.h"
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
diff --git a/mojo/public/tests/bindings_connector_unittest.cc b/mojo/public/tests/bindings/connector_unittest.cc
index a20190e..4e1feba 100644
--- a/mojo/public/tests/bindings_connector_unittest.cc
+++ b/mojo/public/tests/bindings/connector_unittest.cc
@@ -9,7 +9,7 @@
#include "mojo/public/bindings/lib/connector.h"
#include "mojo/public/bindings/lib/message_queue.h"
#include "mojo/public/system/macros.h"
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
@@ -37,9 +37,9 @@ class MessageAccumulator : public MessageReceiver {
MessageQueue queue_;
};
-class BindingsConnectorTest : public testing::Test {
+class ConnectorTest : public testing::Test {
public:
- BindingsConnectorTest() {
+ ConnectorTest() {
}
virtual void SetUp() MOJO_OVERRIDE {
@@ -70,7 +70,7 @@ class BindingsConnectorTest : public testing::Test {
SimpleBindingsSupport bindings_support_;
};
-TEST_F(BindingsConnectorTest, Basic) {
+TEST_F(ConnectorTest, Basic) {
internal::Connector connector0(handle0_.Pass());
internal::Connector connector1(handle1_.Pass());
@@ -96,7 +96,7 @@ TEST_F(BindingsConnectorTest, Basic) {
reinterpret_cast<char*>(message_received.data->payload)));
}
-TEST_F(BindingsConnectorTest, Basic_EarlyIncomingReceiver) {
+TEST_F(ConnectorTest, Basic_EarlyIncomingReceiver) {
internal::Connector connector0(handle0_.Pass());
internal::Connector connector1(handle1_.Pass());
@@ -122,7 +122,7 @@ TEST_F(BindingsConnectorTest, Basic_EarlyIncomingReceiver) {
reinterpret_cast<char*>(message_received.data->payload)));
}
-TEST_F(BindingsConnectorTest, Basic_TwoMessages) {
+TEST_F(ConnectorTest, Basic_TwoMessages) {
internal::Connector connector0(handle0_.Pass());
internal::Connector connector1(handle1_.Pass());
@@ -152,7 +152,7 @@ TEST_F(BindingsConnectorTest, Basic_TwoMessages) {
}
}
-TEST_F(BindingsConnectorTest, WriteToClosedPipe) {
+TEST_F(ConnectorTest, WriteToClosedPipe) {
// Leak this, so the closed handle isn't closed again.
MojoHandle mojo_handle = handle0_.get().value();
internal::Connector* connector0 = new internal::Connector(handle0_.Pass());
@@ -172,7 +172,7 @@ TEST_F(BindingsConnectorTest, WriteToClosedPipe) {
}
// Enable this test once MojoWriteMessage supports passing handles.
-TEST_F(BindingsConnectorTest, MessageWithHandles) {
+TEST_F(ConnectorTest, MessageWithHandles) {
internal::Connector connector0(handle0_.Pass());
internal::Connector connector1(handle1_.Pass());
diff --git a/mojo/public/tests/bindings_handle_passing_unittest.cc b/mojo/public/tests/bindings/handle_passing_unittest.cc
index 2f687de..21b26f2 100644
--- a/mojo/public/tests/bindings_handle_passing_unittest.cc
+++ b/mojo/public/tests/bindings/handle_passing_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "mojo/public/bindings/lib/remote_ptr.h"
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "mojo/public/tests/test_support.h"
#include "mojom/sample_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/mojo/public/tests/math_calculator.mojom b/mojo/public/tests/bindings/math_calculator.mojom
index 949a902..949a902 100644
--- a/mojo/public/tests/math_calculator.mojom
+++ b/mojo/public/tests/bindings/math_calculator.mojom
diff --git a/mojo/public/tests/bindings_remote_ptr_unittest.cc b/mojo/public/tests/bindings/remote_ptr_unittest.cc
index 0d52224..d990bce 100644
--- a/mojo/public/tests/bindings_remote_ptr_unittest.cc
+++ b/mojo/public/tests/bindings/remote_ptr_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "mojo/public/bindings/lib/remote_ptr.h"
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "mojom/math_calculator.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -79,13 +79,13 @@ class MathCalculatorUIImpl : public math::CalculatorUI {
double output_;
};
-class BindingsRemotePtrTest : public testing::Test {
+class RemotePtrTest : public testing::Test {
public:
- BindingsRemotePtrTest() {
+ RemotePtrTest() {
CreateMessagePipe(&pipe0_, &pipe1_);
}
- virtual ~BindingsRemotePtrTest() {
+ virtual ~RemotePtrTest() {
}
void PumpMessages() {
@@ -100,7 +100,7 @@ class BindingsRemotePtrTest : public testing::Test {
SimpleBindingsSupport bindings_support_;
};
-TEST_F(BindingsRemotePtrTest, EndToEnd) {
+TEST_F(RemotePtrTest, EndToEnd) {
// Suppose this is instantiated in a process that has pipe0_.
MathCalculatorImpl calculator(pipe0_.Pass());
@@ -115,7 +115,7 @@ TEST_F(BindingsRemotePtrTest, EndToEnd) {
EXPECT_EQ(10.0, calculator_ui.GetOutput());
}
-TEST_F(BindingsRemotePtrTest, Movable) {
+TEST_F(RemotePtrTest, Movable) {
RemotePtr<math::Calculator> a;
RemotePtr<math::Calculator> b(pipe0_.Pass(), NULL);
@@ -128,7 +128,7 @@ TEST_F(BindingsRemotePtrTest, Movable) {
EXPECT_TRUE(b.is_null());
}
-TEST_F(BindingsRemotePtrTest, Resettable) {
+TEST_F(RemotePtrTest, Resettable) {
RemotePtr<math::Calculator> a;
EXPECT_TRUE(a.is_null());
@@ -147,7 +147,7 @@ TEST_F(BindingsRemotePtrTest, Resettable) {
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, CloseRaw(handle));
}
-TEST_F(BindingsRemotePtrTest, EncounteredError) {
+TEST_F(RemotePtrTest, EncounteredError) {
MathCalculatorImpl* calculator = new MathCalculatorImpl(pipe0_.Pass());
MathCalculatorUIImpl calculator_ui(pipe1_.Pass());
diff --git a/mojo/public/tests/sample_factory.mojom b/mojo/public/tests/bindings/sample_factory.mojom
index 7ae6b34..7ae6b34 100644
--- a/mojo/public/tests/sample_factory.mojom
+++ b/mojo/public/tests/bindings/sample_factory.mojom
diff --git a/mojo/public/bindings/sample/sample_service.mojom b/mojo/public/tests/bindings/sample_service.mojom
index e2ad62c..e2ad62c 100644
--- a/mojo/public/bindings/sample/sample_service.mojom
+++ b/mojo/public/tests/bindings/sample_service.mojom
diff --git a/mojo/public/bindings/sample/sample_service_unittests.cc b/mojo/public/tests/bindings/sample_service_unittests.cc
index 8670441..3fe8a11 100644
--- a/mojo/public/bindings/sample/sample_service_unittests.cc
+++ b/mojo/public/tests/bindings/sample_service_unittests.cc
@@ -6,7 +6,7 @@
#include <ostream>
#include <string>
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "mojom/sample_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -25,9 +25,13 @@ class TypeConverter<sample::Bar, int32_t> {
} // namespace mojo
namespace sample {
+namespace {
-// Set this variable to true to print the binary message in hex.
-bool g_dump_message_as_hex = true;
+// Set this variable to true to print the message in hex.
+bool g_dump_message_as_hex = false;
+
+// Set this variable to true to print the message in human readable form.
+bool g_dump_message_as_text = false;
// Make a sample |Foo|.
Foo MakeFoo() {
@@ -135,38 +139,38 @@ void CheckFoo(const Foo& foo) {
EXPECT_EQ(2u, foo.output_streams().size());
}
-static void PrintSpacer(int depth) {
+void PrintSpacer(int depth) {
for (int i = 0; i < depth; ++i)
std::cout << " ";
}
-static void Print(int depth, const char* name, bool value) {
+void Print(int depth, const char* name, bool value) {
PrintSpacer(depth);
std::cout << name << ": " << (value ? "true" : "false") << std::endl;
}
-static void Print(int depth, const char* name, int32_t value) {
+void Print(int depth, const char* name, int32_t value) {
PrintSpacer(depth);
std::cout << name << ": " << value << std::endl;
}
-static void Print(int depth, const char* name, uint8_t value) {
+void Print(int depth, const char* name, uint8_t value) {
PrintSpacer(depth);
std::cout << name << ": " << uint32_t(value) << std::endl;
}
-static void Print(int depth, const char* name, mojo::Handle value) {
+void Print(int depth, const char* name, mojo::Handle value) {
PrintSpacer(depth);
std::cout << name << ": 0x" << std::hex << value.value() << std::endl;
}
-static void Print(int depth, const char* name, const mojo::String& str) {
+void Print(int depth, const char* name, const mojo::String& str) {
std::string s = str.To<std::string>();
PrintSpacer(depth);
std::cout << name << ": \"" << str.To<std::string>() << "\"" << std::endl;
}
-static void Print(int depth, const char* name, const Bar& bar) {
+void Print(int depth, const char* name, const Bar& bar) {
PrintSpacer(depth);
std::cout << name << ":" << std::endl;
if (!bar.is_null()) {
@@ -180,13 +184,13 @@ static void Print(int depth, const char* name, const Bar& bar) {
}
template <typename T>
-static void Print(int depth, const char* name,
+void Print(int depth, const char* name,
const mojo::Passable<T>& passable) {
Print(depth, name, passable.get());
}
template <typename T>
-static void Print(int depth, const char* name, const mojo::Array<T>& array) {
+void Print(int depth, const char* name, const mojo::Array<T>& array) {
PrintSpacer(depth);
std::cout << name << ":" << std::endl;
if (!array.is_null()) {
@@ -200,7 +204,7 @@ static void Print(int depth, const char* name, const mojo::Array<T>& array) {
}
}
-static void Print(int depth, const char* name, const Foo& foo) {
+void Print(int depth, const char* name, const Foo& foo) {
PrintSpacer(depth);
std::cout << name << ":" << std::endl;
if (!foo.is_null()) {
@@ -221,7 +225,7 @@ static void Print(int depth, const char* name, const Foo& foo) {
}
}
-static void DumpHex(const uint8_t* bytes, uint32_t num_bytes) {
+void DumpHex(const uint8_t* bytes, uint32_t num_bytes) {
for (uint32_t i = 0; i < num_bytes; ++i) {
std::cout << std::setw(2) << std::setfill('0') << std::hex <<
uint32_t(bytes[i]);
@@ -249,13 +253,14 @@ class ServiceImpl : public Service {
CheckFoo(foo);
EXPECT_EQ(BAZ_EXTRA, baz);
- // Also dump the Foo structure and all of its members.
- // TODO(vtl): Make it optional, so that the test spews less?
- std::cout << "Frobinate:" << std::endl;
- int depth = 1;
- Print(depth, "foo", foo);
- Print(depth, "baz", baz);
- Print(depth, "port", port.get());
+ if (g_dump_message_as_text) {
+ // Also dump the Foo structure and all of its members.
+ std::cout << "Frobinate:" << std::endl;
+ int depth = 1;
+ Print(depth, "foo", foo);
+ Print(depth, "baz", baz);
+ Print(depth, "port", port.get());
+ }
}
};
@@ -278,6 +283,8 @@ class SimpleMessageReceiver : public mojo::MessageReceiver {
}
};
+} // namespace
+
TEST(BindingsSampleTest, Basic) {
mojo::test::SimpleBindingsSupport bindings_support;
SimpleMessageReceiver receiver;
diff --git a/mojo/public/tests/simple_bindings_support.cc b/mojo/public/tests/bindings/simple_bindings_support.cc
index eba5ccc..ceabc1e 100644
--- a/mojo/public/tests/simple_bindings_support.cc
+++ b/mojo/public/tests/bindings/simple_bindings_support.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include <stdlib.h>
diff --git a/mojo/public/tests/simple_bindings_support.h b/mojo/public/tests/bindings/simple_bindings_support.h
index e124625..e124625 100644
--- a/mojo/public/tests/simple_bindings_support.h
+++ b/mojo/public/tests/bindings/simple_bindings_support.h
diff --git a/mojo/public/tests/test_structs.mojom b/mojo/public/tests/bindings/test_structs.mojom
index c205e84..c205e84 100644
--- a/mojo/public/tests/test_structs.mojom
+++ b/mojo/public/tests/bindings/test_structs.mojom
diff --git a/mojo/public/tests/bindings_type_conversion_unittest.cc b/mojo/public/tests/bindings/type_conversion_unittest.cc
index 8e62345..fb92b60 100644
--- a/mojo/public/tests/bindings_type_conversion_unittest.cc
+++ b/mojo/public/tests/bindings/type_conversion_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/public/tests/simple_bindings_support.h"
+#include "mojo/public/tests/bindings/simple_bindings_support.h"
#include "mojom/test_structs.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -64,12 +64,12 @@ class TypeConverter<test_structs::NamedRegion, RedmondNamedRegion> {
namespace test {
-class BindingsTypeConversionTest : public testing::Test {
+class TypeConversionTest : public testing::Test {
private:
SimpleBindingsSupport bindings_support_;
};
-TEST_F(BindingsTypeConversionTest, String) {
+TEST_F(TypeConversionTest, String) {
AllocationScope scope;
const char kText[6] = "hello";
@@ -83,7 +83,7 @@ TEST_F(BindingsTypeConversionTest, String) {
EXPECT_EQ(std::string(kText), c.To<std::string>());
}
-TEST_F(BindingsTypeConversionTest, String_Null) {
+TEST_F(TypeConversionTest, String_Null) {
String a;
EXPECT_TRUE(a.is_null());
EXPECT_EQ(std::string(), a.To<std::string>());
@@ -92,7 +92,7 @@ TEST_F(BindingsTypeConversionTest, String_Null) {
EXPECT_TRUE(b.is_null());
}
-TEST_F(BindingsTypeConversionTest, String_Empty) {
+TEST_F(TypeConversionTest, String_Empty) {
AllocationScope scope;
String a = String::Builder(0).Finish();
EXPECT_EQ(std::string(), a.To<std::string>());
@@ -102,7 +102,7 @@ TEST_F(BindingsTypeConversionTest, String_Empty) {
EXPECT_EQ(std::string(), b.To<std::string>());
}
-TEST_F(BindingsTypeConversionTest, String_ShallowCopy) {
+TEST_F(TypeConversionTest, String_ShallowCopy) {
AllocationScope scope;
String a("hello");
@@ -112,7 +112,7 @@ TEST_F(BindingsTypeConversionTest, String_ShallowCopy) {
EXPECT_EQ(a.To<std::string>(), b.To<std::string>());
}
-TEST_F(BindingsTypeConversionTest, StringWithEmbeddedNull) {
+TEST_F(TypeConversionTest, StringWithEmbeddedNull) {
AllocationScope scope;
const std::string kText("hel\0lo", 6);
@@ -125,7 +125,7 @@ TEST_F(BindingsTypeConversionTest, StringWithEmbeddedNull) {
EXPECT_EQ(std::string("hel"), b.To<std::string>());
}
-TEST_F(BindingsTypeConversionTest, CustomTypeConverter) {
+TEST_F(TypeConversionTest, CustomTypeConverter) {
AllocationScope scope;
test_structs::Rect::Builder rect_builder;
@@ -148,7 +148,7 @@ TEST_F(BindingsTypeConversionTest, CustomTypeConverter) {
EXPECT_EQ(rect.height(), rect2.height());
}
-TEST_F(BindingsTypeConversionTest, CustomTypeConverter_Array_Null) {
+TEST_F(TypeConversionTest, CustomTypeConverter_Array_Null) {
Array<test_structs::Rect> rects;
std::vector<RedmondRect> redmond_rects =
@@ -157,7 +157,7 @@ TEST_F(BindingsTypeConversionTest, CustomTypeConverter_Array_Null) {
EXPECT_TRUE(redmond_rects.empty());
}
-TEST_F(BindingsTypeConversionTest, CustomTypeConverter_Array) {
+TEST_F(TypeConversionTest, CustomTypeConverter_Array) {
AllocationScope scope;
const RedmondRect kBase = { 10, 20, 30, 40 };
@@ -199,7 +199,7 @@ TEST_F(BindingsTypeConversionTest, CustomTypeConverter_Array) {
}
}
-TEST_F(BindingsTypeConversionTest, CustomTypeConverter_Nested) {
+TEST_F(TypeConversionTest, CustomTypeConverter_Nested) {
AllocationScope scope;
RedmondNamedRegion redmond_region;
diff --git a/mojo/public/tests/system/DEPS b/mojo/public/tests/system/DEPS
new file mode 100644
index 0000000..6c53bc2
--- /dev/null
+++ b/mojo/public/tests/system/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+testing",
+]
diff --git a/mojo/public/tests/system_core_cpp_unittest.cc b/mojo/public/tests/system/core_cpp_unittest.cc
index 8bce421..8bce421 100644
--- a/mojo/public/tests/system_core_cpp_unittest.cc
+++ b/mojo/public/tests/system/core_cpp_unittest.cc
diff --git a/mojo/public/tests/system_core_perftest.cc b/mojo/public/tests/system/core_perftest.cc
index 4d791c3..6bfe986 100644
--- a/mojo/public/tests/system_core_perftest.cc
+++ b/mojo/public/tests/system/core_perftest.cc
@@ -14,10 +14,10 @@
namespace {
-class SystemPerftest : public testing::Test {
+class CorePerftest : public testing::Test {
public:
- SystemPerftest() {}
- virtual ~SystemPerftest() {}
+ CorePerftest() {}
+ virtual ~CorePerftest() {}
void NoOp() {
}
@@ -61,56 +61,56 @@ class SystemPerftest : public testing::Test {
MojoHandle h_1_;
private:
- DISALLOW_COPY_AND_ASSIGN(SystemPerftest);
+ DISALLOW_COPY_AND_ASSIGN(CorePerftest);
};
// A no-op test so we can compare performance.
-TEST_F(SystemPerftest, NoOp) {
+TEST_F(CorePerftest, NoOp) {
mojo::test::IterateAndReportPerf(
"NoOp",
- base::Bind(&SystemPerftest::NoOp,
+ base::Bind(&CorePerftest::NoOp,
base::Unretained(this)));
}
-TEST_F(SystemPerftest, MessagePipe_CreateAndClose) {
+TEST_F(CorePerftest, MessagePipe_CreateAndClose) {
mojo::test::IterateAndReportPerf(
"MessagePipe_CreateAndClose",
- base::Bind(&SystemPerftest::MessagePipe_CreateAndClose,
+ base::Bind(&CorePerftest::MessagePipe_CreateAndClose,
base::Unretained(this)));
}
-TEST_F(SystemPerftest, MessagePipe_WriteAndRead) {
+TEST_F(CorePerftest, MessagePipe_WriteAndRead) {
CHECK_EQ(MojoCreateMessagePipe(&h_0_, &h_1_), MOJO_RESULT_OK);
char buffer[10000] = { 0 };
mojo::test::IterateAndReportPerf(
"MessagePipe_WriteAndRead_10bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
+ base::Bind(&CorePerftest::MessagePipe_WriteAndRead,
base::Unretained(this),
static_cast<void*>(buffer), static_cast<uint32_t>(10)));
mojo::test::IterateAndReportPerf(
"MessagePipe_WriteAndRead_100bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
+ base::Bind(&CorePerftest::MessagePipe_WriteAndRead,
base::Unretained(this),
static_cast<void*>(buffer), static_cast<uint32_t>(100)));
mojo::test::IterateAndReportPerf(
"MessagePipe_WriteAndRead_1000bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
+ base::Bind(&CorePerftest::MessagePipe_WriteAndRead,
base::Unretained(this),
static_cast<void*>(buffer), static_cast<uint32_t>(1000)));
mojo::test::IterateAndReportPerf(
"MessagePipe_WriteAndRead_10000bytes",
- base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
+ base::Bind(&CorePerftest::MessagePipe_WriteAndRead,
base::Unretained(this),
static_cast<void*>(buffer), static_cast<uint32_t>(10000)));
CHECK_EQ(MojoClose(h_0_), MOJO_RESULT_OK);
CHECK_EQ(MojoClose(h_1_), MOJO_RESULT_OK);
}
-TEST_F(SystemPerftest, MessagePipe_EmptyRead) {
+TEST_F(CorePerftest, MessagePipe_EmptyRead) {
CHECK_EQ(MojoCreateMessagePipe(&h_0_, &h_1_), MOJO_RESULT_OK);
mojo::test::IterateAndReportPerf(
"MessagePipe_EmptyRead",
- base::Bind(&SystemPerftest::MessagePipe_EmptyRead,
+ base::Bind(&CorePerftest::MessagePipe_EmptyRead,
base::Unretained(this)));
CHECK_EQ(MojoClose(h_0_), MOJO_RESULT_OK);
CHECK_EQ(MojoClose(h_1_), MOJO_RESULT_OK);
diff --git a/mojo/public/tests/system_core_unittest.cc b/mojo/public/tests/system/core_unittest.cc
index 5d751b2..01f677b 100644
--- a/mojo/public/tests/system_core_unittest.cc
+++ b/mojo/public/tests/system/core_unittest.cc
@@ -13,13 +13,13 @@
namespace mojo {
namespace {
-TEST(SystemTest, GetTimeTicksNow) {
+TEST(CoreTest, GetTimeTicksNow) {
const MojoTimeTicks start = MojoGetTimeTicksNow();
EXPECT_NE(static_cast<MojoTimeTicks>(0), start)
<< "MojoGetTimeTicksNow should return nonzero value";
}
-TEST(SystemTest, Basic) {
+TEST(CoreTest, Basic) {
MojoHandle h_0;
MojoWaitFlags wf;
char buffer[10] = { 0 };
diff --git a/mojo/public/utility/bindings_support_impl_unittest.cc b/mojo/public/tests/utility/bindings_support_impl_unittest.cc
index b2c248c..b2c248c 100644
--- a/mojo/public/utility/bindings_support_impl_unittest.cc
+++ b/mojo/public/tests/utility/bindings_support_impl_unittest.cc
diff --git a/mojo/public/utility/run_loop_unittest.cc b/mojo/public/tests/utility/run_loop_unittest.cc
index 9092eb5..9092eb5 100644
--- a/mojo/public/utility/run_loop_unittest.cc
+++ b/mojo/public/tests/utility/run_loop_unittest.cc
diff --git a/mojo/public/utility/thread_local_unittest.cc b/mojo/public/tests/utility/thread_local_unittest.cc
index 72e3084..72e3084 100644
--- a/mojo/public/utility/thread_local_unittest.cc
+++ b/mojo/public/tests/utility/thread_local_unittest.cc
diff --git a/mojo/public/utility/DEPS b/mojo/public/utility/DEPS
deleted file mode 100644
index f9cdd47..0000000
--- a/mojo/public/utility/DEPS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Tests can include base.
-specific_include_rules = {
- ".*unittest.cc": [
- "+base",
- ],
-}
-
-include_rules = [
- # For OS_XXX.
- "+build/build_config.h",
-]
diff --git a/mojo/public/utility/thread_local.h b/mojo/public/utility/thread_local.h
index 4935b47..1b5a2fc 100644
--- a/mojo/public/utility/thread_local.h
+++ b/mojo/public/utility/thread_local.h
@@ -48,9 +48,7 @@
#ifndef MOJO_PUBLIC_UTILITY_THREAD_LOCAL_H_
#define MOJO_PUBLIC_UTILITY_THREAD_LOCAL_H_
-#include "build/build_config.h"
-
-#if defined(OS_POSIX)
+#ifndef _WIN32
#include <pthread.h>
#endif
@@ -61,9 +59,9 @@ namespace internal {
// Helper functions that abstract the cross-platform APIs. Do not use directly.
struct ThreadLocalPlatform {
-#if defined(OS_WIN)
+#ifdef _WIN32
typedef unsigned long SlotType;
-#elif defined(OS_POSIX)
+#else
typedef pthread_key_t SlotType;
#endif
diff --git a/mojo/tools/mojob.sh b/mojo/tools/mojob.sh
index 69af1a2..5d99a6a 100755
--- a/mojo/tools/mojob.sh
+++ b/mojo/tools/mojob.sh
@@ -47,10 +47,11 @@ do_build() {
do_unittests() {
echo "Running unit tests in out/$1 ..."
- "out/$1/mojo_bindings_unittests" || exit 1
"out/$1/mojo_common_unittests" || exit 1
"out/$1/mojo_js_unittests" || exit 1
- "out/$1/mojo_public_unittests" || exit 1
+ "out/$1/mojo_public_bindings_unittests" || exit 1
+ "out/$1/mojo_public_system_unittests" || exit 1
+ "out/$1/mojo_public_utility_unittests" || exit 1
"out/$1/mojo_shell_unittests" || exit 1
"out/$1/mojo_system_unittests" || exit 1
"out/$1/mojo_utility_unittests" || exit 1
@@ -58,7 +59,7 @@ do_unittests() {
do_perftests() {
echo "Running perf tests in out/$1 ..."
- "out/$1/mojo_public_perftests" || exit 1
+ "out/$1/mojo_public_system_perftests" || exit 1
}
do_gyp() {