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

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

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
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>
11
10 #include "base/bind.h" 12 #include "base/bind.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "base/test/launcher/unit_test_launcher.h" 16 #include "base/test/launcher/unit_test_launcher.h"
16 #include "base/test/test_suite.h" 17 #include "base/test/test_suite.h"
17 #include "base/threading/platform_thread.h" 18 #include "base/threading/platform_thread.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace arc { 22 namespace arc {
22 23
(...skipping 14 matching lines...) Expand all
37 base_loop_.reset(new base::MessageLoopForIO()); 38 base_loop_.reset(new base::MessageLoopForIO());
38 run_loop_.reset(new base::RunLoop()); 39 run_loop_.reset(new base::RunLoop());
39 40
40 // This cannot be put inside SetUp() because we need to run it after fork(). 41 // This cannot be put inside SetUp() because we need to run it after fork().
41 helper_.reset(new ServiceHelper()); 42 helper_.reset(new ServiceHelper());
42 helper_->Init(base::Bind(&ServiceHelperTest::Quit, 43 helper_->Init(base::Bind(&ServiceHelperTest::Quit,
43 base::Unretained(this))); 44 base::Unretained(this)));
44 } 45 }
45 46
46 protected: 47 protected:
47 scoped_ptr<base::MessageLoopForIO> base_loop_; 48 std::unique_ptr<base::MessageLoopForIO> base_loop_;
48 scoped_ptr<base::RunLoop> run_loop_; 49 std::unique_ptr<base::RunLoop> run_loop_;
49 scoped_ptr<ServiceHelper> helper_; 50 std::unique_ptr<ServiceHelper> helper_;
50 51
51 private: 52 private:
52 DISALLOW_COPY_AND_ASSIGN(ServiceHelperTest); 53 DISALLOW_COPY_AND_ASSIGN(ServiceHelperTest);
53 }; 54 };
54 55
55 TEST_F(ServiceHelperTest, CheckExternalTerm) { 56 TEST_F(ServiceHelperTest, CheckExternalTerm) {
56 // Fork ourselves and run it. 57 // Fork ourselves and run it.
57 pid_t child_pid = fork(); 58 pid_t child_pid = fork();
58 if (child_pid == 0) { // Child process 59 if (child_pid == 0) { // Child process
59 Init(); 60 Init();
(...skipping 16 matching lines...) Expand all
76 } 77 }
77 78
78 } // namespace arc 79 } // namespace arc
79 80
80 int main(int argc, char** argv) { 81 int main(int argc, char** argv) {
81 base::TestSuite test_suite(argc, argv); 82 base::TestSuite test_suite(argc, argv);
82 return base::LaunchUnitTestsSerially( 83 return base::LaunchUnitTestsSerially(
83 argc, argv, 84 argc, argv,
84 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); 85 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
85 } 86 }
OLDNEW
« no previous file with comments | « components/arc/standalone/arc_standalone_bridge_runner.h ('k') | components/arc/test/fake_app_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698