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

Side by Side Diff: remoting/host/setup/me2me_native_messaging_host_unittest.cc

Issue 2962443002: Rename TaskRunner::RunsTasksOnCurrentThread() in //remoting, //android_webview (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « remoting/host/security_key/security_key_message_reader_impl.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 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 "remoting/host/setup/me2me_native_messaging_host.h" 5 #include "remoting/host/setup/me2me_native_messaging_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstdint> 9 #include <cstdint>
10 #include <memory> 10 #include <memory>
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 host_task_runner_->PostTask( 315 host_task_runner_->PostTask(
316 FROM_HERE, 316 FROM_HERE,
317 base::Bind(&Me2MeNativeMessagingHostTest::StartHost, 317 base::Bind(&Me2MeNativeMessagingHostTest::StartHost,
318 base::Unretained(this))); 318 base::Unretained(this)));
319 319
320 // Wait until the host finishes starting. 320 // Wait until the host finishes starting.
321 test_run_loop_->Run(); 321 test_run_loop_->Run();
322 } 322 }
323 323
324 void Me2MeNativeMessagingHostTest::StartHost() { 324 void Me2MeNativeMessagingHostTest::StartHost() {
325 DCHECK(host_task_runner_->RunsTasksOnCurrentThread()); 325 DCHECK(host_task_runner_->RunsTasksInCurrentSequence());
326 326
327 base::File input_read_file; 327 base::File input_read_file;
328 base::File output_write_file; 328 base::File output_write_file;
329 329
330 ASSERT_TRUE(MakePipe(&input_read_file, &input_write_file_)); 330 ASSERT_TRUE(MakePipe(&input_read_file, &input_write_file_));
331 ASSERT_TRUE(MakePipe(&output_read_file_, &output_write_file)); 331 ASSERT_TRUE(MakePipe(&output_read_file_, &output_write_file));
332 332
333 daemon_controller_delegate_ = new MockDaemonControllerDelegate(); 333 daemon_controller_delegate_ = new MockDaemonControllerDelegate();
334 scoped_refptr<DaemonController> daemon_controller( 334 scoped_refptr<DaemonController> daemon_controller(
335 new DaemonController(base::WrapUnique(daemon_controller_delegate_))); 335 new DaemonController(base::WrapUnique(daemon_controller_delegate_)));
(...skipping 23 matching lines...) Expand all
359 host->Start(native_messaging_pipe_.get()); 359 host->Start(native_messaging_pipe_.get());
360 360
361 native_messaging_pipe_->Start(std::move(host), std::move(channel)); 361 native_messaging_pipe_->Start(std::move(host), std::move(channel));
362 362
363 // Notify the test that the host has finished starting up. 363 // Notify the test that the host has finished starting up.
364 test_message_loop_->task_runner()->PostTask( 364 test_message_loop_->task_runner()->PostTask(
365 FROM_HERE, test_run_loop_->QuitClosure()); 365 FROM_HERE, test_run_loop_->QuitClosure());
366 } 366 }
367 367
368 void Me2MeNativeMessagingHostTest::StopHost() { 368 void Me2MeNativeMessagingHostTest::StopHost() {
369 DCHECK(host_task_runner_->RunsTasksOnCurrentThread()); 369 DCHECK(host_task_runner_->RunsTasksInCurrentSequence());
370 370
371 native_messaging_pipe_.reset(); 371 native_messaging_pipe_.reset();
372 372
373 // Wait till all shutdown tasks have completed. 373 // Wait till all shutdown tasks have completed.
374 base::RunLoop().RunUntilIdle(); 374 base::RunLoop().RunUntilIdle();
375 375
376 // Trigger a test shutdown via ExitTest(). 376 // Trigger a test shutdown via ExitTest().
377 host_task_runner_ = nullptr; 377 host_task_runner_ = nullptr;
378 } 378 }
379 379
380 void Me2MeNativeMessagingHostTest::ExitTest() { 380 void Me2MeNativeMessagingHostTest::ExitTest() {
381 if (!test_message_loop_->task_runner()->RunsTasksOnCurrentThread()) { 381 if (!test_message_loop_->task_runner()->RunsTasksInCurrentSequence()) {
382 test_message_loop_->task_runner()->PostTask( 382 test_message_loop_->task_runner()->PostTask(
383 FROM_HERE, 383 FROM_HERE,
384 base::Bind(&Me2MeNativeMessagingHostTest::ExitTest, 384 base::Bind(&Me2MeNativeMessagingHostTest::ExitTest,
385 base::Unretained(this))); 385 base::Unretained(this)));
386 return; 386 return;
387 } 387 }
388 test_run_loop_->Quit(); 388 test_run_loop_->Quit();
389 } 389 }
390 390
391 void Me2MeNativeMessagingHostTest::TearDown() { 391 void Me2MeNativeMessagingHostTest::TearDown() {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 // Verify rejection if getCredentialsFromAuthCode has no auth code. 645 // Verify rejection if getCredentialsFromAuthCode has no auth code.
646 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) { 646 TEST_F(Me2MeNativeMessagingHostTest, GetCredentialsFromAuthCodeNoAuthCode) {
647 base::DictionaryValue message; 647 base::DictionaryValue message;
648 message.SetString("type", "getCredentialsFromAuthCode"); 648 message.SetString("type", "getCredentialsFromAuthCode");
649 TestBadRequest(message); 649 TestBadRequest(message);
650 } 650 }
651 651
652 } // namespace remoting 652 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/security_key/security_key_message_reader_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698