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

Side by Side Diff: components/arc/standalone/service_helper_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/arc/standalone/service_helper.h" 5 #include "components/arc/standalone/service_helper.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h"
16 #include "base/test/launcher/unit_test_launcher.h" 17 #include "base/test/launcher/unit_test_launcher.h"
17 #include "base/test/test_suite.h" 18 #include "base/test/test_suite.h"
18 #include "base/threading/platform_thread.h" 19 #include "base/threading/platform_thread.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace arc { 23 namespace arc {
23 24
24 class ServiceHelperTest : public ::testing::Test { 25 class ServiceHelperTest : public ::testing::Test {
25 public: 26 public:
26 ServiceHelperTest() {} 27 ServiceHelperTest() {}
27 ~ServiceHelperTest() override {} 28 ~ServiceHelperTest() override {}
28 29
29 void Quit() { 30 void Quit() {
30 CHECK(base_loop_); 31 CHECK(base_loop_);
31 CHECK(run_loop_); 32 CHECK(run_loop_);
32 base_loop_->PostTask(FROM_HERE, run_loop_->QuitClosure()); 33 base_loop_->task_runner()->PostTask(FROM_HERE, run_loop_->QuitClosure());
33 } 34 }
34 35
35 void Init() { 36 void Init() {
36 // Dynamically create the message loop to avoid thread check failure of task 37 // Dynamically create the message loop to avoid thread check failure of task
37 // runner in Debug mode. 38 // runner in Debug mode.
38 base_loop_.reset(new base::MessageLoopForIO()); 39 base_loop_.reset(new base::MessageLoopForIO());
39 run_loop_.reset(new base::RunLoop()); 40 run_loop_.reset(new base::RunLoop());
40 41
41 // This cannot be put inside SetUp() because we need to run it after fork(). 42 // This cannot be put inside SetUp() because we need to run it after fork().
42 helper_.reset(new ServiceHelper()); 43 helper_.reset(new ServiceHelper());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 78 }
78 79
79 } // namespace arc 80 } // namespace arc
80 81
81 int main(int argc, char** argv) { 82 int main(int argc, char** argv) {
82 base::TestSuite test_suite(argc, argv); 83 base::TestSuite test_suite(argc, argv);
83 return base::LaunchUnitTestsSerially( 84 return base::LaunchUnitTestsSerially(
84 argc, argv, 85 argc, argv,
85 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); 86 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
86 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698