diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 00:53:27 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-28 00:53:27 +0000 |
commit | 5dddd197efdfc27a7f7701f2f9b5965aa68b771e (patch) | |
tree | c5ac6281af8bdad4f2460a139903ae533e804a85 /mojo/public/tests | |
parent | d232ef502b92b99c405fff9b0ecf9cccd2813398 (diff) | |
download | chromium_src-5dddd197efdfc27a7f7701f2f9b5965aa68b771e.zip chromium_src-5dddd197efdfc27a7f7701f2f9b5965aa68b771e.tar.gz chromium_src-5dddd197efdfc27a7f7701f2f9b5965aa68b771e.tar.bz2 |
Mojo: Move mojo/public/system/core_cpp.h to mojo/cpp/public/system/core.h.
Also begin rearranging tests. (I'm deferring moving macros_unittest.cc
until after I split macros.h.)
R=darin@chromium.org
Review URL: https://codereview.chromium.org/214753004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/public/tests')
-rw-r--r-- | mojo/public/tests/system/core_cpp_unittest.cc | 388 | ||||
-rw-r--r-- | mojo/public/tests/system/core_perftest.cc | 337 | ||||
-rw-r--r-- | mojo/public/tests/system/core_unittest.cc | 286 | ||||
-rw-r--r-- | mojo/public/tests/system/core_unittest_pure_c.c | 88 | ||||
-rw-r--r-- | mojo/public/tests/test_utils.cc | 2 | ||||
-rw-r--r-- | mojo/public/tests/test_utils.h | 2 |
6 files changed, 2 insertions, 1101 deletions
diff --git a/mojo/public/tests/system/core_cpp_unittest.cc b/mojo/public/tests/system/core_cpp_unittest.cc deleted file mode 100644 index 64f91aa..0000000 --- a/mojo/public/tests/system/core_cpp_unittest.cc +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/public/system/core_cpp.h" - -#include <map> - -#include "mojo/public/c/system/macros.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -TEST(CoreCppTest, GetTimeTicksNow) { - const MojoTimeTicks start = GetTimeTicksNow(); - EXPECT_NE(static_cast<MojoTimeTicks>(0), start) - << "GetTimeTicksNow should return nonzero value"; -} - -TEST(CoreCppTest, Basic) { - // Basic |Handle| implementation: - { - EXPECT_EQ(MOJO_HANDLE_INVALID, kInvalidHandleValue); - - Handle h0; - EXPECT_EQ(kInvalidHandleValue, h0.value()); - EXPECT_EQ(kInvalidHandleValue, *h0.mutable_value()); - EXPECT_FALSE(h0.is_valid()); - - Handle h1(static_cast<MojoHandle>(123)); - EXPECT_EQ(static_cast<MojoHandle>(123), h1.value()); - EXPECT_EQ(static_cast<MojoHandle>(123), *h1.mutable_value()); - EXPECT_TRUE(h1.is_valid()); - *h1.mutable_value() = static_cast<MojoHandle>(456); - EXPECT_EQ(static_cast<MojoHandle>(456), h1.value()); - EXPECT_TRUE(h1.is_valid()); - - h1.swap(h0); - EXPECT_EQ(static_cast<MojoHandle>(456), h0.value()); - EXPECT_TRUE(h0.is_valid()); - EXPECT_FALSE(h1.is_valid()); - - h1.set_value(static_cast<MojoHandle>(789)); - h0.swap(h1); - EXPECT_EQ(static_cast<MojoHandle>(789), h0.value()); - EXPECT_TRUE(h0.is_valid()); - EXPECT_EQ(static_cast<MojoHandle>(456), h1.value()); - EXPECT_TRUE(h1.is_valid()); - - // Make sure copy constructor works. - Handle h2(h0); - EXPECT_EQ(static_cast<MojoHandle>(789), h2.value()); - // And assignment. - h2 = h1; - EXPECT_EQ(static_cast<MojoHandle>(456), h2.value()); - - // Make sure that we can put |Handle|s into |std::map|s. - h0 = Handle(static_cast<MojoHandle>(987)); - h1 = Handle(static_cast<MojoHandle>(654)); - h2 = Handle(static_cast<MojoHandle>(321)); - Handle h3; - std::map<Handle, int> handle_to_int; - handle_to_int[h0] = 0; - handle_to_int[h1] = 1; - handle_to_int[h2] = 2; - handle_to_int[h3] = 3; - - EXPECT_EQ(4u, handle_to_int.size()); - EXPECT_FALSE(handle_to_int.find(h0) == handle_to_int.end()); - EXPECT_EQ(0, handle_to_int[h0]); - EXPECT_FALSE(handle_to_int.find(h1) == handle_to_int.end()); - EXPECT_EQ(1, handle_to_int[h1]); - EXPECT_FALSE(handle_to_int.find(h2) == handle_to_int.end()); - EXPECT_EQ(2, handle_to_int[h2]); - EXPECT_FALSE(handle_to_int.find(h3) == handle_to_int.end()); - EXPECT_EQ(3, handle_to_int[h3]); - EXPECT_TRUE(handle_to_int.find(Handle(static_cast<MojoHandle>(13579))) == - handle_to_int.end()); - - // TODO(vtl): With C++11, support |std::unordered_map|s, etc. (Or figure out - // how to support the variations of |hash_map|.) - } - - // |Handle|/|ScopedHandle| functions: - { - ScopedHandle h; - - EXPECT_EQ(kInvalidHandleValue, h.get().value()); - - // This should be a no-op. - Close(h.Pass()); - - // It should still be invalid. - EXPECT_EQ(kInvalidHandleValue, h.get().value()); - - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - Wait(h.get(), MOJO_WAIT_FLAG_EVERYTHING, 1000000)); - - std::vector<Handle> wh; - wh.push_back(h.get()); - std::vector<MojoWaitFlags> wf; - wf.push_back(MOJO_WAIT_FLAG_EVERYTHING); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - WaitMany(wh, wf, MOJO_DEADLINE_INDEFINITE)); - } - - // |MakeScopedHandle| (just compilation tests): - { - EXPECT_FALSE(MakeScopedHandle(Handle()).is_valid()); - EXPECT_FALSE(MakeScopedHandle(MessagePipeHandle()).is_valid()); - EXPECT_FALSE(MakeScopedHandle(DataPipeProducerHandle()).is_valid()); - EXPECT_FALSE(MakeScopedHandle(DataPipeConsumerHandle()).is_valid()); - EXPECT_FALSE(MakeScopedHandle(SharedBufferHandle()).is_valid()); - } - - // |MessagePipeHandle|/|ScopedMessagePipeHandle| functions: - { - MessagePipeHandle h_invalid; - EXPECT_FALSE(h_invalid.is_valid()); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - WriteMessageRaw(h_invalid, - NULL, 0, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - char buffer[10] = { 0 }; - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - WriteMessageRaw(h_invalid, - buffer, sizeof(buffer), - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - ReadMessageRaw(h_invalid, - NULL, NULL, - NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - ReadMessageRaw(h_invalid, - buffer, &buffer_size, - NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - - // Basic tests of waiting and closing. - MojoHandle hv0 = kInvalidHandleValue; - { - ScopedMessagePipeHandle h0; - ScopedMessagePipeHandle h1; - EXPECT_FALSE(h0.get().is_valid()); - EXPECT_FALSE(h1.get().is_valid()); - - CreateMessagePipe(&h0, &h1); - EXPECT_TRUE(h0.get().is_valid()); - EXPECT_TRUE(h1.get().is_valid()); - EXPECT_NE(h0.get().value(), h1.get().value()); - // Save the handle values, so we can check that things got closed - // correctly. - hv0 = h0.get().value(); - MojoHandle hv1 = h1.get().value(); - - EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, - Wait(h0.get(), MOJO_WAIT_FLAG_READABLE, 0)); - std::vector<Handle> wh; - wh.push_back(h0.get()); - wh.push_back(h1.get()); - std::vector<MojoWaitFlags> wf; - wf.push_back(MOJO_WAIT_FLAG_READABLE); - wf.push_back(MOJO_WAIT_FLAG_WRITABLE); - EXPECT_EQ(1, WaitMany(wh, wf, 1000)); - - // Test closing |h1| explicitly. - Close(h1.Pass()); - EXPECT_FALSE(h1.get().is_valid()); - - // Make sure |h1| is closed. - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWait(hv1, MOJO_WAIT_FLAG_EVERYTHING, - MOJO_DEADLINE_INDEFINITE)); - - EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, - Wait(h0.get(), MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE)); - } - // |hv0| should have been closed when |h0| went out of scope, so this close - // should fail. - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(hv0)); - - // Actually test writing/reading messages. - { - ScopedMessagePipeHandle h0; - ScopedMessagePipeHandle h1; - CreateMessagePipe(&h0, &h1); - - const char kHello[] = "hello"; - const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h0.get(), - kHello, kHelloSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - EXPECT_EQ(MOJO_RESULT_OK, - Wait(h1.get(), MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE)); - char buffer[10] = { 0 }; - uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_OK, - ReadMessageRaw(h1.get(), - buffer, &buffer_size, - NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - EXPECT_EQ(kHelloSize, buffer_size); - EXPECT_STREQ(kHello, buffer); - - // Send a handle over the previously-establish message pipe. Use the - // |MessagePipe| wrapper (to test it), which automatically creates a - // message pipe. - MessagePipe mp; - - // Write a message to |mp.handle0|, before we send |mp.handle1|. - const char kWorld[] = "world!"; - const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld)); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(mp.handle0.get(), - kWorld, kWorldSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - - // Send |mp.handle1| over |h1| to |h0|. - MojoHandle handles[5]; - handles[0] = mp.handle1.release().value(); - EXPECT_NE(kInvalidHandleValue, handles[0]); - EXPECT_FALSE(mp.handle1.get().is_valid()); - uint32_t handles_count = 1; - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h1.get(), - kHello, kHelloSize, - handles, handles_count, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - // |handles[0]| should actually be invalid now. - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(handles[0])); - - // Read "hello" and the sent handle. - EXPECT_EQ(MOJO_RESULT_OK, - Wait(h0.get(), MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE)); - memset(buffer, 0, sizeof(buffer)); - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - for (size_t i = 0; i < MOJO_ARRAYSIZE(handles); i++) - handles[i] = kInvalidHandleValue; - handles_count = static_cast<uint32_t>(MOJO_ARRAYSIZE(handles)); - EXPECT_EQ(MOJO_RESULT_OK, - ReadMessageRaw(h0.get(), - buffer, &buffer_size, - handles, &handles_count, - MOJO_READ_MESSAGE_FLAG_NONE)); - EXPECT_EQ(kHelloSize, buffer_size); - EXPECT_STREQ(kHello, buffer); - EXPECT_EQ(1u, handles_count); - EXPECT_NE(kInvalidHandleValue, handles[0]); - - // Read from the sent/received handle. - mp.handle1.reset(MessagePipeHandle(handles[0])); - // Save |handles[0]| to check that it gets properly closed. - hv0 = handles[0]; - EXPECT_EQ(MOJO_RESULT_OK, - Wait(mp.handle1.get(), MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE)); - memset(buffer, 0, sizeof(buffer)); - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - for (size_t i = 0; i < MOJO_ARRAYSIZE(handles); i++) - handles[i] = kInvalidHandleValue; - handles_count = static_cast<uint32_t>(MOJO_ARRAYSIZE(handles)); - EXPECT_EQ(MOJO_RESULT_OK, - ReadMessageRaw(mp.handle1.get(), - buffer, &buffer_size, - handles, &handles_count, - MOJO_READ_MESSAGE_FLAG_NONE)); - EXPECT_EQ(kWorldSize, buffer_size); - EXPECT_STREQ(kWorld, buffer); - EXPECT_EQ(0u, handles_count); - } - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(hv0)); - } - - // TODO(vtl): Test |CloseRaw()|. - // TODO(vtl): Test |reset()| more thoroughly? -} - -TEST(CoreCppTest, TearDownWithMessagesEnqueued) { - // Tear down a message pipe which still has a message enqueued, with the - // message also having a valid message pipe handle. - { - ScopedMessagePipeHandle h0; - ScopedMessagePipeHandle h1; - CreateMessagePipe(&h0, &h1); - - // Send a handle over the previously-establish message pipe. - ScopedMessagePipeHandle h2; - ScopedMessagePipeHandle h3; - CreateMessagePipe(&h2, &h3); - - // Write a message to |h2|, before we send |h3|. - const char kWorld[] = "world!"; - const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld)); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h2.get(), - kWorld, kWorldSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - // And also a message to |h3|. - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h3.get(), - kWorld, kWorldSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - - // Send |h3| over |h1| to |h0|. - const char kHello[] = "hello"; - const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); - MojoHandle h3_value; - h3_value = h3.release().value(); - EXPECT_NE(kInvalidHandleValue, h3_value); - EXPECT_FALSE(h3.get().is_valid()); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h1.get(), - kHello, kHelloSize, - &h3_value, 1, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - // |h3_value| should actually be invalid now. - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(h3_value)); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0.release().value())); - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1.release().value())); - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2.release().value())); - } - - // Do this in a different order: make the enqueued message pipe handle only - // half-alive. - { - ScopedMessagePipeHandle h0; - ScopedMessagePipeHandle h1; - CreateMessagePipe(&h0, &h1); - - // Send a handle over the previously-establish message pipe. - ScopedMessagePipeHandle h2; - ScopedMessagePipeHandle h3; - CreateMessagePipe(&h2, &h3); - - // Write a message to |h2|, before we send |h3|. - const char kWorld[] = "world!"; - const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld)); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h2.get(), - kWorld, kWorldSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - // And also a message to |h3|. - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h3.get(), - kWorld, kWorldSize, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - - // Send |h3| over |h1| to |h0|. - const char kHello[] = "hello"; - const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); - MojoHandle h3_value; - h3_value = h3.release().value(); - EXPECT_NE(kInvalidHandleValue, h3_value); - EXPECT_FALSE(h3.get().is_valid()); - EXPECT_EQ(MOJO_RESULT_OK, - WriteMessageRaw(h1.get(), - kHello, kHelloSize, - &h3_value, 1, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - // |h3_value| should actually be invalid now. - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(h3_value)); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h2.release().value())); - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0.release().value())); - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1.release().value())); - } -} - -// TODO(vtl): Write data pipe tests. - -} // namespace -} // namespace mojo diff --git a/mojo/public/tests/system/core_perftest.cc b/mojo/public/tests/system/core_perftest.cc deleted file mode 100644 index 53ac6b8..0000000 --- a/mojo/public/tests/system/core_perftest.cc +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This tests the performance of the C API. - -#include "mojo/public/c/system/core.h" - -#include <assert.h> -#include <stddef.h> -#include <stdint.h> -#include <stdio.h> - -#include "mojo/public/c/system/macros.h" -#include "mojo/public/tests/test_support.h" -#include "mojo/public/tests/test_utils.h" -#include "testing/gtest/include/gtest/gtest.h" - -// TODO(vtl): (here and below) crbug.com/342893 -#if !defined(WIN32) -#include <time.h> -#include "mojo/public/utility/thread.h" -#endif // !defined(WIN32) - -namespace { - -#if !defined(WIN32) -class MessagePipeWriterThread : public mojo::Thread { - public: - MessagePipeWriterThread(MojoHandle handle, uint32_t num_bytes) - : handle_(handle), - num_bytes_(num_bytes), - num_writes_(0) {} - virtual ~MessagePipeWriterThread() {} - - virtual void Run() MOJO_OVERRIDE { - char buffer[10000]; - assert(num_bytes_ <= sizeof(buffer)); - - // TODO(vtl): Should I throttle somehow? - for (;;) { - MojoResult result = MojoWriteMessage(handle_, buffer, num_bytes_, NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE); - if (result == MOJO_RESULT_OK) { - num_writes_++; - continue; - } - - // We failed to write. - // Either |handle_| or its peer was closed. - assert(result == MOJO_RESULT_INVALID_ARGUMENT || - result == MOJO_RESULT_FAILED_PRECONDITION); - break; - } - } - - // Use only after joining the thread. - int64_t num_writes() const { return num_writes_; } - - private: - const MojoHandle handle_; - const uint32_t num_bytes_; - int64_t num_writes_; - - MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeWriterThread); -}; - -class MessagePipeReaderThread : public mojo::Thread { - public: - explicit MessagePipeReaderThread(MojoHandle handle) - : handle_(handle), - num_reads_(0) { - } - virtual ~MessagePipeReaderThread() {} - - virtual void Run() MOJO_OVERRIDE { - char buffer[10000]; - - for (;;) { - uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer)); - MojoResult result = MojoReadMessage(handle_, buffer, &num_bytes, NULL, - NULL, MOJO_READ_MESSAGE_FLAG_NONE); - if (result == MOJO_RESULT_OK) { - num_reads_++; - continue; - } - - if (result == MOJO_RESULT_SHOULD_WAIT) { - result = MojoWait(handle_, MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE); - if (result == MOJO_RESULT_OK) { - // Go to the top of the loop to read again. - continue; - } - } - - // We failed to read and possibly failed to wait. - // Either |handle_| or its peer was closed. - assert(result == MOJO_RESULT_INVALID_ARGUMENT || - result == MOJO_RESULT_FAILED_PRECONDITION); - break; - } - } - - // Use only after joining the thread. - int64_t num_reads() const { return num_reads_; } - - private: - const MojoHandle handle_; - int64_t num_reads_; - - MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeReaderThread); -}; -#endif // !defined(WIN32) - -class CorePerftest : public testing::Test { - public: - CorePerftest() : buffer_(NULL), num_bytes_(0) {} - virtual ~CorePerftest() {} - - static void NoOp(void* /*closure*/) { - } - - static void MessagePipe_CreateAndClose(void* closure) { - CorePerftest* self = static_cast<CorePerftest*>(closure); - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoCreateMessagePipe(&self->h0_, &self->h1_); - assert(result == MOJO_RESULT_OK); - result = MojoClose(self->h0_); - assert(result == MOJO_RESULT_OK); - result = MojoClose(self->h1_); - assert(result == MOJO_RESULT_OK); - } - - static void MessagePipe_WriteAndRead(void* closure) { - CorePerftest* self = static_cast<CorePerftest*>(closure); - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoWriteMessage(self->h0_, - self->buffer_, self->num_bytes_, - NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE); - assert(result == MOJO_RESULT_OK); - uint32_t read_bytes = self->num_bytes_; - result = MojoReadMessage(self->h1_, - self->buffer_, &read_bytes, - NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE); - assert(result == MOJO_RESULT_OK); - } - - static void MessagePipe_EmptyRead(void* closure) { - CorePerftest* self = static_cast<CorePerftest*>(closure); - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoReadMessage(self->h0_, - NULL, NULL, - NULL, NULL, - MOJO_READ_MESSAGE_FLAG_MAY_DISCARD); - assert(result == MOJO_RESULT_SHOULD_WAIT); - } - - protected: -#if !defined(WIN32) - void DoMessagePipeThreadedTest(unsigned num_writers, - unsigned num_readers, - uint32_t num_bytes) { - static const int64_t kPerftestTimeMicroseconds = 3 * 1000000; - - assert(num_writers > 0); - assert(num_readers > 0); - - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoCreateMessagePipe(&h0_, &h1_); - assert(result == MOJO_RESULT_OK); - - std::vector<MessagePipeWriterThread*> writers; - for (unsigned i = 0; i < num_writers; i++) - writers.push_back(new MessagePipeWriterThread(h0_, num_bytes)); - - std::vector<MessagePipeReaderThread*> readers; - for (unsigned i = 0; i < num_readers; i++) - readers.push_back(new MessagePipeReaderThread(h1_)); - - // Start time here, just before we fire off the threads. - const MojoTimeTicks start_time = MojoGetTimeTicksNow(); - - // Interleave the starts. - for (unsigned i = 0; i < num_writers || i < num_readers; i++) { - if (i < num_writers) - writers[i]->Start(); - if (i < num_readers) - readers[i]->Start(); - } - - Sleep(kPerftestTimeMicroseconds); - - // Close both handles to make writers and readers stop immediately. - result = MojoClose(h0_); - assert(result == MOJO_RESULT_OK); - result = MojoClose(h1_); - assert(result == MOJO_RESULT_OK); - - // Join everything. - for (unsigned i = 0; i < num_writers; i++) - writers[i]->Join(); - for (unsigned i = 0; i < num_readers; i++) - readers[i]->Join(); - - // Stop time here. - MojoTimeTicks end_time = MojoGetTimeTicksNow(); - - // Add up write and read counts, and destroy the threads. - int64_t num_writes = 0; - for (unsigned i = 0; i < num_writers; i++) { - num_writes += writers[i]->num_writes(); - delete writers[i]; - } - writers.clear(); - int64_t num_reads = 0; - for (unsigned i = 0; i < num_readers; i++) { - num_reads += readers[i]->num_reads(); - delete readers[i]; - } - readers.clear(); - - char test_name[200]; - sprintf(test_name, "MessagePipe_Threaded_Writes_%uw_%ur_%ubytes", - num_writers, num_readers, static_cast<unsigned>(num_bytes)); - mojo::test::LogPerfResult(test_name, - 1000000.0 * static_cast<double>(num_writes) / - (end_time - start_time), - "writes/second"); - sprintf(test_name, "MessagePipe_Threaded_Reads_%uw_%ur_%ubytes", - num_writers, num_readers, static_cast<unsigned>(num_bytes)); - mojo::test::LogPerfResult(test_name, - 1000000.0 * static_cast<double>(num_reads) / - (end_time - start_time), - "reads/second"); - } -#endif // !defined(WIN32) - - MojoHandle h0_; - MojoHandle h1_; - - void* buffer_; - uint32_t num_bytes_; - - private: -#if !defined(WIN32) - void Sleep(int64_t microseconds) { - struct timespec req = { - static_cast<time_t>(microseconds / 1000000), // Seconds. - static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds. - }; - int rv MOJO_ALLOW_UNUSED; - rv = nanosleep(&req, NULL); - assert(rv == 0); - } -#endif // !defined(WIN32) - - MOJO_DISALLOW_COPY_AND_ASSIGN(CorePerftest); -}; - -// A no-op test so we can compare performance. -TEST_F(CorePerftest, NoOp) { - mojo::test::IterateAndReportPerf("NoOp", &CorePerftest::NoOp, this); -} - -TEST_F(CorePerftest, MessagePipe_CreateAndClose) { - mojo::test::IterateAndReportPerf("MessagePipe_CreateAndClose", - &CorePerftest::MessagePipe_CreateAndClose, - this); -} - -TEST_F(CorePerftest, MessagePipe_WriteAndRead) { - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoCreateMessagePipe(&h0_, &h1_); - assert(result == MOJO_RESULT_OK); - char buffer[10000] = { 0 }; - buffer_ = buffer; - num_bytes_ = 10u; - mojo::test::IterateAndReportPerf("MessagePipe_WriteAndRead_10bytes", - &CorePerftest::MessagePipe_WriteAndRead, - this); - num_bytes_ = 100u; - mojo::test::IterateAndReportPerf("MessagePipe_WriteAndRead_100bytes", - &CorePerftest::MessagePipe_WriteAndRead, - this); - num_bytes_ = 1000u; - mojo::test::IterateAndReportPerf("MessagePipe_WriteAndRead_1000bytes", - &CorePerftest::MessagePipe_WriteAndRead, - this); - num_bytes_ = 10000u; - mojo::test::IterateAndReportPerf("MessagePipe_WriteAndRead_10000bytes", - &CorePerftest::MessagePipe_WriteAndRead, - this); - result = MojoClose(h0_); - assert(result == MOJO_RESULT_OK); - result = MojoClose(h1_); - assert(result == MOJO_RESULT_OK); -} - -TEST_F(CorePerftest, MessagePipe_EmptyRead) { - MojoResult result MOJO_ALLOW_UNUSED; - result = MojoCreateMessagePipe(&h0_, &h1_); - assert(result == MOJO_RESULT_OK); - mojo::test::IterateAndReportPerf("MessagePipe_EmptyRead", - &CorePerftest::MessagePipe_EmptyRead, - this); - result = MojoClose(h0_); - assert(result == MOJO_RESULT_OK); - result = MojoClose(h1_); - assert(result == MOJO_RESULT_OK); -} - -#if !defined(WIN32) -TEST_F(CorePerftest, MessagePipe_Threaded) { - DoMessagePipeThreadedTest(1u, 1u, 100u); - DoMessagePipeThreadedTest(2u, 2u, 100u); - DoMessagePipeThreadedTest(3u, 3u, 100u); - DoMessagePipeThreadedTest(10u, 10u, 100u); - DoMessagePipeThreadedTest(10u, 1u, 100u); - DoMessagePipeThreadedTest(1u, 10u, 100u); - - // For comparison of overhead: - DoMessagePipeThreadedTest(1u, 1u, 10u); - // 100 was done above. - DoMessagePipeThreadedTest(1u, 1u, 1000u); - DoMessagePipeThreadedTest(1u, 1u, 10000u); - - DoMessagePipeThreadedTest(3u, 3u, 10u); - // 100 was done above. - DoMessagePipeThreadedTest(3u, 3u, 1000u); - DoMessagePipeThreadedTest(3u, 3u, 10000u); -} -#endif // !defined(WIN32) - -} // namespace diff --git a/mojo/public/tests/system/core_unittest.cc b/mojo/public/tests/system/core_unittest.cc deleted file mode 100644 index c9acd00..0000000 --- a/mojo/public/tests/system/core_unittest.cc +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file tests the C API. - -#include "mojo/public/c/system/core.h" - -#include <string.h> - -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -TEST(CoreTest, GetTimeTicksNow) { - const MojoTimeTicks start = MojoGetTimeTicksNow(); - EXPECT_NE(static_cast<MojoTimeTicks>(0), start) - << "MojoGetTimeTicksNow should return nonzero value"; -} - -// The only handle that's guaranteed to be invalid is |MOJO_HANDLE_INVALID|. -// Tests that everything that takes a handle properly recognizes it. -TEST(CoreTest, InvalidHandle) { - MojoHandle h0, h1; - MojoWaitFlags wf; - char buffer[10] = { 0 }; - uint32_t buffer_size; - void* write_pointer; - const void* read_pointer; - - // Close: - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(MOJO_HANDLE_INVALID)); - - // Wait: - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWait(MOJO_HANDLE_INVALID, MOJO_WAIT_FLAG_EVERYTHING, 1000000)); - h0 = MOJO_HANDLE_INVALID; - wf = MOJO_WAIT_FLAG_EVERYTHING; - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWaitMany(&h0, &wf, 1, MOJO_DEADLINE_INDEFINITE)); - - // Message pipe: - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWriteMessage(h0, buffer, 3, NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - - // Data pipe: - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWriteData(h0, buffer, &buffer_size, MOJO_WRITE_DATA_FLAG_NONE)); - write_pointer = NULL; - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoBeginWriteData(h0, &write_pointer, &buffer_size, - MOJO_WRITE_DATA_FLAG_NONE)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoEndWriteData(h0, 1)); - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoReadData(h0, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE)); - read_pointer = NULL; - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoBeginReadData(h0, &read_pointer, &buffer_size, - MOJO_READ_DATA_FLAG_NONE)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoEndReadData(h0, 1)); - - // Shared buffer: - h1 = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoDuplicateBufferHandle(h0, NULL, &h1)); - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoMapBuffer(h0, 0, 1, &write_pointer, MOJO_MAP_BUFFER_FLAG_NONE)); -} - -TEST(CoreTest, BasicMessagePipe) { - MojoHandle h0, h1; - MojoWaitFlags wf; - char buffer[10] = { 0 }; - uint32_t buffer_size; - - h0 = MOJO_HANDLE_INVALID; - h1 = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(&h0, &h1)); - EXPECT_NE(h0, MOJO_HANDLE_INVALID); - EXPECT_NE(h1, MOJO_HANDLE_INVALID); - - // Shouldn't be readable. - EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, - MojoWait(h0, MOJO_WAIT_FLAG_READABLE, 0)); - - // Should be writable. - EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h0, MOJO_WAIT_FLAG_WRITABLE, 0)); - - // Try to read. - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT, - MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - - // Write to |h1|. - static const char kHello[] = "hello"; - buffer_size = static_cast<uint32_t>(sizeof(kHello)); - EXPECT_EQ(MOJO_RESULT_OK, - MojoWriteMessage(h1, kHello, buffer_size, NULL, 0, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - - // |h0| should be readable. - wf = MOJO_WAIT_FLAG_READABLE; - EXPECT_EQ(MOJO_RESULT_OK, - MojoWaitMany(&h0, &wf, 1, MOJO_DEADLINE_INDEFINITE)); - - // Read from |h0|. - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_OK, - MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - EXPECT_EQ(static_cast<uint32_t>(sizeof(kHello)), buffer_size); - EXPECT_STREQ(kHello, buffer); - - // |h0| should no longer be readable. - EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, - MojoWait(h0, MOJO_WAIT_FLAG_READABLE, 10)); - - // Close |h0|. - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0)); - - // |h1| should no longer be readable or writable. - EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, - MojoWait(h1, MOJO_WAIT_FLAG_READABLE | MOJO_WAIT_FLAG_WRITABLE, - 1000)); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); -} - -TEST(CoreTest, BasicDataPipe) { - MojoHandle hp, hc; - MojoWaitFlags wf; - char buffer[20] = { 0 }; - uint32_t buffer_size; - void* write_pointer; - const void* read_pointer; - - hp = MOJO_HANDLE_INVALID; - hc = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_OK, MojoCreateDataPipe(NULL, &hp, &hc)); - EXPECT_NE(hp, MOJO_HANDLE_INVALID); - EXPECT_NE(hc, MOJO_HANDLE_INVALID); - - // The consumer |hc| shouldn't be readable. - EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, - MojoWait(hc, MOJO_WAIT_FLAG_READABLE, 0)); - - // The producer |hp| should be writable. - EXPECT_EQ(MOJO_RESULT_OK, MojoWait(hp, MOJO_WAIT_FLAG_WRITABLE, 0)); - - // Try to read from |hc|. - buffer_size = static_cast<uint32_t>(sizeof(buffer)); - EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT, - MojoReadData(hc, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE)); - - // Try to begin a two-phase read from |hc|. - read_pointer = NULL; - EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT, - MojoBeginReadData(hc, &read_pointer, &buffer_size, - MOJO_READ_DATA_FLAG_NONE)); - - // Write to |hp|. - static const char kHello[] = "hello "; - // Don't include terminating null. - buffer_size = static_cast<uint32_t>(strlen(kHello)); - EXPECT_EQ(MOJO_RESULT_OK, - MojoWriteData(hp, kHello, &buffer_size, - MOJO_WRITE_MESSAGE_FLAG_NONE)); - - // |hc| should be(come) readable. - wf = MOJO_WAIT_FLAG_READABLE; - EXPECT_EQ(MOJO_RESULT_OK, - MojoWaitMany(&hc, &wf, 1, MOJO_DEADLINE_INDEFINITE)); - - // Do a two-phase write to |hp|. - EXPECT_EQ(MOJO_RESULT_OK, - MojoBeginWriteData(hp, &write_pointer, &buffer_size, - MOJO_WRITE_DATA_FLAG_NONE)); - static const char kWorld[] = "world"; - ASSERT_GE(buffer_size, sizeof(kWorld)); - // Include the terminating null. - memcpy(write_pointer, kWorld, sizeof(kWorld)); - EXPECT_EQ(MOJO_RESULT_OK, - MojoEndWriteData(hp, static_cast<uint32_t>(sizeof(kWorld)))); - - // Read one character from |hc|. - memset(buffer, 0, sizeof(buffer)); - buffer_size = 1; - EXPECT_EQ(MOJO_RESULT_OK, - MojoReadData(hc, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE)); - - // Close |hp|. - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(hp)); - - // |hc| should still be readable. - EXPECT_EQ(MOJO_RESULT_OK, MojoWait(hc, MOJO_WAIT_FLAG_READABLE, 0)); - - // Do a two-phase read from |hc|. - read_pointer = NULL; - EXPECT_EQ(MOJO_RESULT_OK, - MojoBeginReadData(hc, &read_pointer, &buffer_size, - MOJO_READ_DATA_FLAG_NONE)); - ASSERT_LE(buffer_size, sizeof(buffer) - 1); - memcpy(&buffer[1], read_pointer, buffer_size); - EXPECT_EQ(MOJO_RESULT_OK, MojoEndReadData(hc, buffer_size)); - EXPECT_STREQ("hello world", buffer); - - // |hc| should no longer be readable. - EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, - MojoWait(hc, MOJO_WAIT_FLAG_READABLE, 1000)); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(hc)); - - // TODO(vtl): Test the other way around -- closing the consumer should make - // the producer never-writable? -} - -TEST(CoreTest, BasicSharedBuffer) { - MojoHandle h0, h1; - void* pointer; - - // Create a shared buffer (|h0|). - h0 = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_OK, MojoCreateSharedBuffer(NULL, 100, &h0)); - EXPECT_NE(h0, MOJO_HANDLE_INVALID); - - // Map everything. - pointer = NULL; - EXPECT_EQ(MOJO_RESULT_OK, - MojoMapBuffer(h0, 0, 100, &pointer, MOJO_MAP_BUFFER_FLAG_NONE)); - ASSERT_TRUE(pointer); - static_cast<char*>(pointer)[50] = 'x'; - - // Duplicate |h0| to |h1|. - h1 = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_OK, MojoDuplicateBufferHandle(h0, NULL, &h1)); - EXPECT_NE(h1, MOJO_HANDLE_INVALID); - - // Close |h0|. - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0)); - - // The mapping should still be good. - static_cast<char*>(pointer)[51] = 'y'; - - // Unmap it. - // TODO(vtl): Not yet implemented. - EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, MojoUnmapBuffer(pointer)); - - // Map half of |h1|. - pointer = NULL; - EXPECT_EQ(MOJO_RESULT_OK, - MojoMapBuffer(h1, 50, 50, &pointer, MOJO_MAP_BUFFER_FLAG_NONE)); - ASSERT_TRUE(pointer); - - // It should have what we wrote. - EXPECT_EQ('x', static_cast<char*>(pointer)[0]); - EXPECT_EQ('y', static_cast<char*>(pointer)[1]); - - // Unmap it. - // TODO(vtl): Not yet implemented. - EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, MojoUnmapBuffer(pointer)); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1)); -} - -// Defined in core_unittest_pure_c.c. -extern "C" const char* MinimalCTest(void); - -// This checks that things actually work in C (not C++). -TEST(CoreTest, MinimalCTest) { - const char* failure = MinimalCTest(); - EXPECT_TRUE(failure == NULL) << failure; -} - -// TODO(vtl): Add multi-threaded tests. - -} // namespace -} // namespace mojo diff --git a/mojo/public/tests/system/core_unittest_pure_c.c b/mojo/public/tests/system/core_unittest_pure_c.c deleted file mode 100644 index 7293ff2..0000000 --- a/mojo/public/tests/system/core_unittest_pure_c.c +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifdef __cplusplus -#error "This file should be compiled as C, not C++." -#endif - -#include <stddef.h> -#include <string.h> - -// Include all the header files that are meant to be compilable as C. Start with -// core.h, since it's the most important one. -#include "mojo/public/c/system/core.h" -#include "mojo/public/c/system/async_waiter.h" -#include "mojo/public/c/system/macros.h" - -// The joys of the C preprocessor.... -#define STRINGIFY(x) #x -#define STRINGIFY2(x) STRINGIFY(x) -#define FAILURE(message) \ - __FILE__ "(" STRINGIFY2(__LINE__) "): Failure: " message - -// Poor man's gtest. -#define EXPECT_EQ(a, b) \ - do { \ - if ((a) != (b)) \ - return FAILURE(STRINGIFY(a) " != " STRINGIFY(b) " (expected ==)"); \ - } while (0) -#define EXPECT_NE(a, b) \ - do { \ - if ((a) == (b)) \ - return FAILURE(STRINGIFY(a) " == " STRINGIFY(b) " (expected !=)"); \ - } while (0) - -// This function exists mainly to be compiled and linked. We do some cursory -// checks and call it from a unit test, to make sure that link problems aren't -// missed due to deadstripping. Returns null on success and a string on failure -// (describing the failure). -const char* MinimalCTest(void) { - // MSVS before 2013 *really* only supports C90: All variables must be declared - // at the top. (MSVS 2013 is more reasonable.) - MojoTimeTicks ticks; - MojoHandle handle0, handle1; - MojoWaitFlags wait_flags; - const char kHello[] = "hello"; - char buffer[200] = { 0 }; - uint32_t num_bytes; - - ticks = MojoGetTimeTicksNow(); - EXPECT_NE(ticks, 0); - - handle0 = MOJO_HANDLE_INVALID; - EXPECT_NE(MOJO_RESULT_OK, MojoClose(handle0)); - - EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, - MojoWait(handle0, MOJO_WAIT_FLAG_EVERYTHING, - MOJO_DEADLINE_INDEFINITE)); - - handle1 = MOJO_HANDLE_INVALID; - EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(&handle0, &handle1)); - - wait_flags = MOJO_WAIT_FLAG_READABLE; - EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, - MojoWaitMany(&handle0, &wait_flags, 1, 1)); - - EXPECT_EQ(MOJO_RESULT_OK, - MojoWriteMessage(handle0, kHello, (uint32_t) sizeof(kHello), NULL, - 0u, MOJO_WRITE_DATA_FLAG_NONE)); - - EXPECT_EQ(MOJO_RESULT_OK, - MojoWait(handle1, MOJO_WAIT_FLAG_READABLE, - MOJO_DEADLINE_INDEFINITE)); - - num_bytes = (uint32_t) sizeof(buffer); - EXPECT_EQ(MOJO_RESULT_OK, - MojoReadMessage(handle1, buffer, &num_bytes, NULL, NULL, - MOJO_READ_MESSAGE_FLAG_NONE)); - EXPECT_EQ((uint32_t) sizeof(kHello), num_bytes); - EXPECT_EQ(0, memcmp(buffer, kHello, sizeof(kHello))); - - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle0)); - EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle1)); - - // TODO(vtl): data pipe - - return NULL; -} diff --git a/mojo/public/tests/test_utils.cc b/mojo/public/tests/test_utils.cc index 9b6eeaa..2e9bc38 100644 --- a/mojo/public/tests/test_utils.cc +++ b/mojo/public/tests/test_utils.cc @@ -4,7 +4,7 @@ #include "mojo/public/tests/test_utils.h" -#include "mojo/public/system/core_cpp.h" +#include "mojo/public/cpp/system/core.h" #include "mojo/public/tests/test_support.h" namespace mojo { diff --git a/mojo/public/tests/test_utils.h b/mojo/public/tests/test_utils.h index a8c9d16..300c1b7 100644 --- a/mojo/public/tests/test_utils.h +++ b/mojo/public/tests/test_utils.h @@ -7,7 +7,7 @@ #include <string> -#include "mojo/public/system/core_cpp.h" +#include "mojo/public/cpp/system/core.h" namespace mojo { namespace test { |