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

Side by Side Diff: base/android/application_status_listener_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/allocator/allocator_shim_unittest.cc ('k') | base/android/java_handler_thread.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/android/application_status_listener.h" 5 #include "base/android/application_status_listener.h"
6
7 #include <memory>
8
6 #include "base/bind.h" 9 #include "base/bind.h"
7 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
8 #include "base/logging.h" 11 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 13 #include "base/run_loop.h"
12 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
14 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
15 17
16 namespace base { 18 namespace base {
17 namespace android { 19 namespace android {
18 20
19 namespace { 21 namespace {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void StoreStateAndSignal(ApplicationState state) { 87 void StoreStateAndSignal(ApplicationState state) {
86 ExpectOnThread(); 88 ExpectOnThread();
87 state_ = state; 89 state_ = state;
88 event_.Signal(); 90 event_.Signal();
89 } 91 }
90 92
91 ApplicationState state_; 93 ApplicationState state_;
92 base::WaitableEvent event_; 94 base::WaitableEvent event_;
93 base::Thread thread_; 95 base::Thread thread_;
94 base::MessageLoop main_; 96 base::MessageLoop main_;
95 scoped_ptr<ApplicationStatusListener> listener_; 97 std::unique_ptr<ApplicationStatusListener> listener_;
96 }; 98 };
97 99
98 } // namespace 100 } // namespace
99 101
100 TEST(ApplicationStatusListenerTest, SingleThread) { 102 TEST(ApplicationStatusListenerTest, SingleThread) {
101 MessageLoop message_loop; 103 MessageLoop message_loop;
102 104
103 ApplicationState result = kInvalidApplicationState; 105 ApplicationState result = kInvalidApplicationState;
104 106
105 // Create a new listener that stores the new state into |result| on every 107 // Create a new listener that stores the new state into |result| on every
(...skipping 14 matching lines...) Expand all
120 EXPECT_EQ(APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES, result); 122 EXPECT_EQ(APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES, result);
121 } 123 }
122 124
123 TEST(ApplicationStatusListenerTest, TwoThreads) { 125 TEST(ApplicationStatusListenerTest, TwoThreads) {
124 MultiThreadedTest test; 126 MultiThreadedTest test;
125 test.Run(); 127 test.Run();
126 } 128 }
127 129
128 } // namespace android 130 } // namespace android
129 } // namespace base 131 } // namespace base
OLDNEW
« no previous file with comments | « base/allocator/allocator_shim_unittest.cc ('k') | base/android/java_handler_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698