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

Side by Side Diff: mojo/apps/js/test/js_to_cpp_unittest.cc

Issue 282823003: Mojo: cancel pending AsyncWait calls when the callers thread exits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: env first Created 6 years, 7 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 | « no previous file | mojo/common/handle_watcher.h » ('j') | 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 "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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | mojo/common/handle_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698