OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
9 #include "mojo/application/public/cpp/application_test_base.h" | 9 #include "mojo/application/public/cpp/application_test_base.h" |
10 #include "mojo/application/public/cpp/interface_factory.h" | 10 #include "mojo/application/public/cpp/interface_factory.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 ApplicationManagerAppTestDelegate* delegate_; | 84 ApplicationManagerAppTestDelegate* delegate_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(ApplicationManagerAppTest); | 86 DISALLOW_COPY_AND_ASSIGN(ApplicationManagerAppTest); |
87 }; | 87 }; |
88 | 88 |
89 TEST_F(ApplicationManagerAppTest, CreateInstanceForHandle) { | 89 TEST_F(ApplicationManagerAppTest, CreateInstanceForHandle) { |
90 // 1. Launch a process. (Actually, have the runner launch a process that | 90 // 1. Launch a process. (Actually, have the runner launch a process that |
91 // launches a process. #becauselinkerrors). | 91 // launches a process. #becauselinkerrors). |
92 mojo::shell::test::mojom::DriverPtr driver; | 92 mojo::shell::test::mojom::DriverPtr driver; |
93 application_impl()->ConnectToService( | 93 application_impl()->ConnectToService("exe:application_manager_apptest_driver", |
94 URLRequest::From(std::string("exe:application_manager_apptest_driver")), | 94 &driver); |
95 &driver); | |
96 | 95 |
97 // 2. Wait for it to connect to us. (via mojo:application_manager_apptests) | 96 // 2. Wait for it to connect to us. (via mojo:application_manager_apptests) |
98 base::MessageLoop::current()->Run(); | 97 base::MessageLoop::current()->Run(); |
99 | 98 |
100 // 3. Profit! | 99 // 3. Profit! |
101 EXPECT_EQ(data(), "From Target"); | 100 EXPECT_EQ(data(), "From Target"); |
102 | 101 |
103 driver.set_connection_error_handler( | 102 driver.set_connection_error_handler( |
104 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, | 103 base::Bind(&ApplicationManagerAppTest::OnDriverQuit, |
105 base::Unretained(this))); | 104 base::Unretained(this))); |
106 driver->QuitDriver(); | 105 driver->QuitDriver(); |
107 base::MessageLoop::current()->Run(); | 106 base::MessageLoop::current()->Run(); |
108 } | 107 } |
109 | 108 |
110 } // namespace shell | 109 } // namespace shell |
111 } // namespace mojo | 110 } // namespace mojo |
OLD | NEW |