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

Unified Diff: mojo/public/cpp/bindings/tests/array_unittest.cc

Issue 328713004: Mojo: Use the MessagePipe creation helper whenever possible/reasonable in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/tests/connector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/array_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/array_unittest.cc b/mojo/public/cpp/bindings/tests/array_unittest.cc
index b0c1f6b65347228c9ef5a9e9974ad56b1da6d7c6..0bf11f7142dcaae7b7daca0e26a4933d672ad4f4 100644
--- a/mojo/public/cpp/bindings/tests/array_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/array_unittest.cc
@@ -35,37 +35,33 @@ TEST(ArrayTest, Bool) {
// Tests that Array<ScopedMessagePipeHandle> supports transferring handles.
TEST(ArrayTest, Handle) {
- ScopedMessagePipeHandle pipe0, pipe1;
- CreateMessagePipe(&pipe0, &pipe1);
-
+ MessagePipe pipe;
Array<ScopedMessagePipeHandle> handles(2);
- handles[0] = pipe0.Pass();
- handles[1].reset(pipe1.release());
+ handles[0] = pipe.handle0.Pass();
+ handles[1].reset(pipe.handle1.release());
- EXPECT_FALSE(pipe0.is_valid());
- EXPECT_FALSE(pipe1.is_valid());
+ EXPECT_FALSE(pipe.handle0.is_valid());
+ EXPECT_FALSE(pipe.handle1.is_valid());
Array<ScopedMessagePipeHandle> handles2 = handles.Pass();
EXPECT_TRUE(handles2[0].is_valid());
EXPECT_TRUE(handles2[1].is_valid());
- pipe0 = handles2[0].Pass();
- EXPECT_TRUE(pipe0.is_valid());
+ ScopedMessagePipeHandle pipe_handle = handles2[0].Pass();
+ EXPECT_TRUE(pipe_handle.is_valid());
EXPECT_FALSE(handles2[0].is_valid());
}
// Tests that Array<ScopedMessagePipeHandle> supports closing handles.
TEST(ArrayTest, HandlesAreClosed) {
- ScopedMessagePipeHandle pipe0, pipe1;
- CreateMessagePipe(&pipe0, &pipe1);
-
- MojoHandle pipe0_value = pipe0.get().value();
- MojoHandle pipe1_value = pipe1.get().value();
+ MessagePipe pipe;
+ MojoHandle pipe0_value = pipe.handle0.get().value();
+ MojoHandle pipe1_value = pipe.handle0.get().value();
{
Array<ScopedMessagePipeHandle> handles(2);
- handles[0] = pipe0.Pass();
- handles[1].reset(pipe1.release());
+ handles[0] = pipe.handle0.Pass();
+ handles[1].reset(pipe.handle0.release());
}
// We expect the pipes to have been closed.
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/tests/connector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698