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

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

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. Created 5 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
« no previous file with comments | « no previous file | base/async_socket_io_handler_unittest.cc » ('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 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback_forward.h" 7 #include "base/callback_forward.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace base { 16 namespace base {
17 namespace android { 17 namespace android {
18 18
19 namespace { 19 namespace {
20 20
(...skipping 21 matching lines...) Expand all
42 MultiThreadedTest() 42 MultiThreadedTest()
43 : state_(kInvalidApplicationState), 43 : state_(kInvalidApplicationState),
44 event_(false, false), 44 event_(false, false),
45 thread_("ApplicationStatusTest thread"), 45 thread_("ApplicationStatusTest thread"),
46 main_() { 46 main_() {
47 } 47 }
48 48
49 void Run() { 49 void Run() {
50 // Start the thread and tell it to register for events. 50 // Start the thread and tell it to register for events.
51 thread_.Start(); 51 thread_.Start();
52 thread_.message_loop() 52 thread_.task_runner()->PostTask(
53 ->PostTask(FROM_HERE, 53 FROM_HERE, base::Bind(&MultiThreadedTest::RegisterThreadForEvents,
54 base::Bind(&MultiThreadedTest::RegisterThreadForEvents,
55 base::Unretained(this))); 54 base::Unretained(this)));
56 55
57 // Wait for its completion. 56 // Wait for its completion.
58 event_.Wait(); 57 event_.Wait();
59 58
60 // Change state, then wait for the thread to modify state. 59 // Change state, then wait for the thread to modify state.
61 ApplicationStatusListener::NotifyApplicationStateChange( 60 ApplicationStatusListener::NotifyApplicationStateChange(
62 APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); 61 APPLICATION_STATE_HAS_RUNNING_ACTIVITIES);
63 event_.Wait(); 62 event_.Wait();
64 EXPECT_EQ(APPLICATION_STATE_HAS_RUNNING_ACTIVITIES, state_); 63 EXPECT_EQ(APPLICATION_STATE_HAS_RUNNING_ACTIVITIES, state_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 EXPECT_EQ(APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES, result); 120 EXPECT_EQ(APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES, result);
122 } 121 }
123 122
124 TEST(ApplicationStatusListenerTest, TwoThreads) { 123 TEST(ApplicationStatusListenerTest, TwoThreads) {
125 MultiThreadedTest test; 124 MultiThreadedTest test;
126 test.Run(); 125 test.Run();
127 } 126 }
128 127
129 } // namespace android 128 } // namespace android
130 } // namespace base 129 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/async_socket_io_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698