OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/public/cpp/environment/environment.h" | 5 #include "mojo/public/cpp/environment/environment.h" |
6 #include "mojo/public/cpp/test_support/test_utils.h" | 6 #include "mojo/public/cpp/test_support/test_utils.h" |
7 #include "mojo/public/cpp/utility/run_loop.h" | 7 #include "mojo/public/cpp/utility/run_loop.h" |
8 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" | 8 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 EXPECT_FALSE(internal::IsHandle<String>::value); | 314 EXPECT_FALSE(internal::IsHandle<String>::value); |
315 } | 315 } |
316 | 316 |
317 TEST_F(HandlePassingTest, CreateNamedObject) { | 317 TEST_F(HandlePassingTest, CreateNamedObject) { |
318 sample::FactoryPtr factory; | 318 sample::FactoryPtr factory; |
319 BindToProxy(new SampleFactoryImpl(), &factory); | 319 BindToProxy(new SampleFactoryImpl(), &factory); |
320 | 320 |
321 sample::NamedObjectPtr object1; | 321 sample::NamedObjectPtr object1; |
322 EXPECT_FALSE(object1); | 322 EXPECT_FALSE(object1); |
323 | 323 |
324 InterfaceRequest<sample::NamedObject> object1_request = Get(&object1); | 324 InterfaceRequest<sample::NamedObject> object1_request = GetProxy(&object1); |
325 EXPECT_TRUE(object1_request.is_pending()); | 325 EXPECT_TRUE(object1_request.is_pending()); |
326 factory->CreateNamedObject(object1_request.Pass()); | 326 factory->CreateNamedObject(object1_request.Pass()); |
327 EXPECT_FALSE(object1_request.is_pending()); // We've passed the request. | 327 EXPECT_FALSE(object1_request.is_pending()); // We've passed the request. |
328 | 328 |
329 ASSERT_TRUE(object1); | 329 ASSERT_TRUE(object1); |
330 object1->SetName("object1"); | 330 object1->SetName("object1"); |
331 | 331 |
332 sample::NamedObjectPtr object2; | 332 sample::NamedObjectPtr object2; |
333 factory->CreateNamedObject(Get(&object2)); | 333 factory->CreateNamedObject(GetProxy(&object2)); |
334 object2->SetName("object2"); | 334 object2->SetName("object2"); |
335 | 335 |
336 std::string name1; | 336 std::string name1; |
337 object1->GetName(StringRecorder(&name1)); | 337 object1->GetName(StringRecorder(&name1)); |
338 | 338 |
339 std::string name2; | 339 std::string name2; |
340 object2->GetName(StringRecorder(&name2)); | 340 object2->GetName(StringRecorder(&name2)); |
341 | 341 |
342 PumpMessages(); // Yield for results. | 342 PumpMessages(); // Yield for results. |
343 | 343 |
344 EXPECT_EQ(std::string("object1"), name1); | 344 EXPECT_EQ(std::string("object1"), name1); |
345 EXPECT_EQ(std::string("object2"), name2); | 345 EXPECT_EQ(std::string("object2"), name2); |
346 } | 346 } |
347 | 347 |
348 } // namespace | 348 } // namespace |
349 } // namespace test | 349 } // namespace test |
350 } // namespace mojo | 350 } // namespace mojo |
OLD | NEW |