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

Side by Side Diff: mojo/public/cpp/bindings/tests/sample_service_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/public/cpp/bindings/tests/handle_passing_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 8
9 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h" 9 #include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 mojo::Array<mojo::Array<bool> > array_of_array_of_bools(2); 76 mojo::Array<mojo::Array<bool> > array_of_array_of_bools(2);
77 for (size_t i = 0; i < 2; ++i) { 77 for (size_t i = 0; i < 2; ++i) {
78 mojo::Array<bool> array_of_bools(2); 78 mojo::Array<bool> array_of_bools(2);
79 for (size_t j = 0; j < 2; ++j) 79 for (size_t j = 0; j < 2; ++j)
80 array_of_bools[j] = j; 80 array_of_bools[j] = j;
81 array_of_array_of_bools[i] = array_of_bools.Pass(); 81 array_of_array_of_bools[i] = array_of_bools.Pass();
82 } 82 }
83 83
84 mojo::ScopedMessagePipeHandle pipe0, pipe1; 84 mojo::MessagePipe pipe;
85 mojo::CreateMessagePipe(&pipe0, &pipe1);
86
87 FooPtr foo(Foo::New()); 85 FooPtr foo(Foo::New());
88 foo->name = name; 86 foo->name = name;
89 foo->x = 1; 87 foo->x = 1;
90 foo->y = 2; 88 foo->y = 2;
91 foo->a = false; 89 foo->a = false;
92 foo->b = true; 90 foo->b = true;
93 foo->c = false; 91 foo->c = false;
94 foo->bar = bar.Pass(); 92 foo->bar = bar.Pass();
95 foo->extra_bars = extra_bars.Pass(); 93 foo->extra_bars = extra_bars.Pass();
96 foo->data = data.Pass(); 94 foo->data = data.Pass();
97 foo->source = pipe1.Pass(); 95 foo->source = pipe.handle1.Pass();
98 foo->input_streams = input_streams.Pass(); 96 foo->input_streams = input_streams.Pass();
99 foo->output_streams = output_streams.Pass(); 97 foo->output_streams = output_streams.Pass();
100 foo->array_of_array_of_bools = array_of_array_of_bools.Pass(); 98 foo->array_of_array_of_bools = array_of_array_of_bools.Pass();
101 99
102 return foo.Pass(); 100 return foo.Pass();
103 } 101 }
104 102
105 // Check that the given |Foo| is identical to the one made by |MakeFoo()|. 103 // Check that the given |Foo| is identical to the one made by |MakeFoo()|.
106 void CheckFoo(const Foo& foo) { 104 void CheckFoo(const Foo& foo) {
107 const std::string kName("foopy"); 105 const std::string kName("foopy");
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 EXPECT_TRUE(defaults->a19.is_null()); 359 EXPECT_TRUE(defaults->a19.is_null());
362 EXPECT_EQ(Bar::TYPE_BOTH, defaults->a20); 360 EXPECT_EQ(Bar::TYPE_BOTH, defaults->a20);
363 EXPECT_TRUE(defaults->a21.is_null()); 361 EXPECT_TRUE(defaults->a21.is_null());
364 ASSERT_FALSE(defaults->a22.is_null()); 362 ASSERT_FALSE(defaults->a22.is_null());
365 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape); 363 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape);
366 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color); 364 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color);
367 } 365 }
368 366
369 } // namespace 367 } // namespace
370 } // namespace sample 368 } // namespace sample
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/handle_passing_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698