Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Unified Diff: mojo/edk/system/shared_buffer_dispatcher_unittest.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/shared_buffer_dispatcher_unittest.cc
diff --git a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
similarity index 86%
copy from third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
copy to mojo/edk/system/shared_buffer_dispatcher_unittest.cc
index b96393c69b25949d7cbae9ea6f27784ce343ce90..ceb936bf36941f79fbed087192ce51806d235bbb 100644
--- a/third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
+++ b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "third_party/mojo/src/mojo/edk/system/shared_buffer_dispatcher.h"
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
#include <limits>
#include "base/memory/ref_counted.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/system/dispatcher.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/edk/embedder/platform_shared_buffer.h"
-#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
-#include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
namespace mojo {
-namespace system {
+namespace edk {
namespace {
// NOTE(vtl): There's currently not much to test for in
@@ -35,7 +35,7 @@ void RevalidateCreateOptions(
MojoCreateSharedBufferOptions revalidated_options = {};
EXPECT_EQ(MOJO_RESULT_OK,
SharedBufferDispatcher::ValidateCreateOptions(
- MakeUserPointer(&validated_options), &revalidated_options));
+ &validated_options, &revalidated_options));
EXPECT_EQ(validated_options.struct_size, revalidated_options.struct_size);
EXPECT_EQ(validated_options.flags, revalidated_options.flags);
}
@@ -45,10 +45,10 @@ class SharedBufferDispatcherTest : public testing::Test {
SharedBufferDispatcherTest() {}
~SharedBufferDispatcherTest() override {}
- embedder::PlatformSupport* platform_support() { return &platform_support_; }
+ PlatformSupport* platform_support() { return &platform_support_; }
private:
- embedder::SimplePlatformSupport platform_support_;
+ SimplePlatformSupport platform_support_;
MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcherTest);
};
@@ -59,7 +59,7 @@ TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsValid) {
{
MojoCreateSharedBufferOptions validated_options = {};
EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::ValidateCreateOptions(
- NullUserPointer(), &validated_options));
+ nullptr, &validated_options));
RevalidateCreateOptions(validated_options);
}
@@ -78,7 +78,7 @@ TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsValid) {
MojoCreateSharedBufferOptions validated_options = {};
EXPECT_EQ(MOJO_RESULT_OK,
SharedBufferDispatcher::ValidateCreateOptions(
- MakeUserPointer(&options), &validated_options))
+ &options, &validated_options))
<< capacity;
RevalidateCreateOptions(validated_options);
EXPECT_EQ(options.flags, validated_options.flags);
@@ -96,7 +96,7 @@ TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsInvalid) {
MojoCreateSharedBufferOptions unused;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
SharedBufferDispatcher::ValidateCreateOptions(
- MakeUserPointer(&options), &unused));
+ &options, &unused));
}
// Unknown |flags|.
@@ -108,7 +108,7 @@ TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsInvalid) {
MojoCreateSharedBufferOptions unused;
EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
SharedBufferDispatcher::ValidateCreateOptions(
- MakeUserPointer(&options), &unused));
+ &options, &unused));
}
}
@@ -122,7 +122,7 @@ TEST_F(SharedBufferDispatcherTest, CreateAndMapBuffer) {
EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher->GetType());
// Make a couple of mappings.
- scoped_ptr<embedder::PlatformSharedBufferMapping> mapping1;
+ scoped_ptr<PlatformSharedBufferMapping> mapping1;
EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping1));
ASSERT_TRUE(mapping1);
@@ -131,7 +131,7 @@ TEST_F(SharedBufferDispatcherTest, CreateAndMapBuffer) {
// Write something.
static_cast<char*>(mapping1->GetBase())[50] = 'x';
- scoped_ptr<embedder::PlatformSharedBufferMapping> mapping2;
+ scoped_ptr<PlatformSharedBufferMapping> mapping2;
EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
50, 50, MOJO_MAP_BUFFER_FLAG_NONE, &mapping2));
ASSERT_TRUE(mapping2);
@@ -155,7 +155,7 @@ TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandle) {
100, &dispatcher1));
// Map and write something.
- scoped_ptr<embedder::PlatformSharedBufferMapping> mapping;
+ scoped_ptr<PlatformSharedBufferMapping> mapping;
EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->MapBuffer(
0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
static_cast<char*>(mapping->GetBase())[0] = 'x';
@@ -164,7 +164,7 @@ TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandle) {
// Duplicate |dispatcher1| and then close it.
scoped_refptr<Dispatcher> dispatcher2;
EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->DuplicateBufferHandle(
- NullUserPointer(), &dispatcher2));
+ nullptr, &dispatcher2));
ASSERT_TRUE(dispatcher2);
EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher2->GetType());
@@ -192,7 +192,7 @@ TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandleOptionsValid) {
for (size_t i = 0; i < MOJO_ARRAYSIZE(options); i++) {
scoped_refptr<Dispatcher> dispatcher2;
EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->DuplicateBufferHandle(
- MakeUserPointer(&options[i]), &dispatcher2));
+ &options[i], &dispatcher2));
ASSERT_TRUE(dispatcher2);
EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher2->GetType());
EXPECT_EQ(MOJO_RESULT_OK, dispatcher2->Close());
@@ -214,8 +214,7 @@ TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandleOptionsInvalid) {
1u, MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE};
scoped_refptr<Dispatcher> dispatcher2;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- dispatcher1->DuplicateBufferHandle(MakeUserPointer(&options),
- &dispatcher2));
+ dispatcher1->DuplicateBufferHandle(&options, &dispatcher2));
EXPECT_FALSE(dispatcher2);
}
@@ -225,8 +224,7 @@ TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandleOptionsInvalid) {
sizeof(MojoDuplicateBufferHandleOptions), ~0u};
scoped_refptr<Dispatcher> dispatcher2;
EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
- dispatcher1->DuplicateBufferHandle(MakeUserPointer(&options),
- &dispatcher2));
+ dispatcher1->DuplicateBufferHandle(&options, &dispatcher2));
EXPECT_FALSE(dispatcher2);
}
@@ -258,7 +256,7 @@ TEST_F(SharedBufferDispatcherTest, MapBufferInvalidArguments) {
SharedBufferDispatcher::kDefaultCreateOptions,
100, &dispatcher));
- scoped_ptr<embedder::PlatformSharedBufferMapping> mapping;
+ scoped_ptr<PlatformSharedBufferMapping> mapping;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
dispatcher->MapBuffer(0, 101, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
EXPECT_FALSE(mapping);
@@ -275,5 +273,5 @@ TEST_F(SharedBufferDispatcherTest, MapBufferInvalidArguments) {
}
} // namespace
-} // namespace system
+} // namespace edk
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698