OLD | NEW |
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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "gin/public/isolate_holder.h" | 10 #include "gin/public/isolate_holder.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 virtual void BitFlipResponse(const js_to_cpp::EchoArgs& arg1) OVERRIDE { | 173 virtual void BitFlipResponse(const js_to_cpp::EchoArgs& arg1) OVERRIDE { |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 } | 175 } |
176 | 176 |
177 protected: | 177 protected: |
178 base::RunLoop* run_loop_; | 178 base::RunLoop* run_loop_; |
179 js_to_cpp::JsSide* js_side_; | 179 js_to_cpp::JsSide* js_side_; |
180 | 180 |
181 private: | 181 private: |
182 Environment environment; | |
183 DISALLOW_COPY_AND_ASSIGN(CppSideConnection); | 182 DISALLOW_COPY_AND_ASSIGN(CppSideConnection); |
184 }; | 183 }; |
185 | 184 |
186 // Trivial test to verify a message sent from JS is received. | 185 // Trivial test to verify a message sent from JS is received. |
187 class PingCppSideConnection : public CppSideConnection { | 186 class PingCppSideConnection : public CppSideConnection { |
188 public: | 187 public: |
189 explicit PingCppSideConnection() : got_message_(false) {} | 188 explicit PingCppSideConnection() : got_message_(false) {} |
190 virtual ~PingCppSideConnection() {} | 189 virtual ~PingCppSideConnection() {} |
191 | 190 |
192 // js_to_cpp::CppSide: | 191 // js_to_cpp::CppSide: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 306 |
308 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); | 307 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); |
309 apps::MojoRunnerDelegate delegate; | 308 apps::MojoRunnerDelegate delegate; |
310 gin::ShellRunner runner(&delegate, instance.isolate()); | 309 gin::ShellRunner runner(&delegate, instance.isolate()); |
311 delegate.Start(&runner, pipe.handle1.release().value(), test); | 310 delegate.Start(&runner, pipe.handle1.release().value(), test); |
312 | 311 |
313 run_loop_.Run(); | 312 run_loop_.Run(); |
314 } | 313 } |
315 | 314 |
316 private: | 315 private: |
| 316 Environment environment; |
317 base::MessageLoop loop; | 317 base::MessageLoop loop; |
318 base::RunLoop run_loop_; | 318 base::RunLoop run_loop_; |
319 | 319 |
320 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); | 320 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); |
321 }; | 321 }; |
322 | 322 |
323 TEST_F(JsToCppTest, Ping) { | 323 TEST_F(JsToCppTest, Ping) { |
324 if (IsRunningOnIsolatedBot()) | 324 if (IsRunningOnIsolatedBot()) |
325 return; | 325 return; |
326 | 326 |
(...skipping 16 matching lines...) Expand all Loading... |
343 if (IsRunningOnIsolatedBot()) | 343 if (IsRunningOnIsolatedBot()) |
344 return; | 344 return; |
345 | 345 |
346 BitFlipCppSideConnection cpp_side_connection; | 346 BitFlipCppSideConnection cpp_side_connection; |
347 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); | 347 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); |
348 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 348 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
349 } | 349 } |
350 | 350 |
351 } // namespace js | 351 } // namespace js |
352 } // namespace mojo | 352 } // namespace mojo |
OLD | NEW |