OLD | NEW |
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 | 5 |
6 #include "base/android/application_status_listener.h" | 6 #include "base/android/application_status_listener.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/metrics/thread_watcher.h" | 9 #include "chrome/browser/metrics/thread_watcher.h" |
10 #include "chrome/browser/metrics/thread_watcher_android.h" | 10 #include "chrome/browser/metrics/thread_watcher_android.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 scoped_ptr<WatchDogThread> watchdog_thread_(new WatchDogThread()); | 49 scoped_ptr<WatchDogThread> watchdog_thread_(new WatchDogThread()); |
50 watchdog_thread_->Start(); | 50 watchdog_thread_->Start(); |
51 | 51 |
52 EXPECT_FALSE(ThreadWatcherList::g_thread_watcher_list_); | 52 EXPECT_FALSE(ThreadWatcherList::g_thread_watcher_list_); |
53 | 53 |
54 | 54 |
55 // Register, and notify the application has just started, | 55 // Register, and notify the application has just started, |
56 // and ensure the thread watcher list is created. | 56 // and ensure the thread watcher list is created. |
57 ThreadWatcherAndroid::RegisterApplicationStatusListener(); | 57 ThreadWatcherAndroid::RegisterApplicationStatusListener(); |
58 ThreadWatcherList::StartWatchingAll(*CommandLine::ForCurrentProcess()); | 58 ThreadWatcherList::StartWatchingAll(*base::CommandLine::ForCurrentProcess()); |
59 NotifyApplicationStateChange( | 59 NotifyApplicationStateChange( |
60 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 60 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
61 EXPECT_TRUE(ThreadWatcherList::g_thread_watcher_list_); | 61 EXPECT_TRUE(ThreadWatcherList::g_thread_watcher_list_); |
62 | 62 |
63 // Notify the application has been stopped, and ensure the thread watcher list | 63 // Notify the application has been stopped, and ensure the thread watcher list |
64 // has been destroyed. | 64 // has been destroyed. |
65 NotifyApplicationStateChange( | 65 NotifyApplicationStateChange( |
66 base::android::APPLICATION_STATE_HAS_STOPPED_ACTIVITIES); | 66 base::android::APPLICATION_STATE_HAS_STOPPED_ACTIVITIES); |
67 EXPECT_FALSE(ThreadWatcherList::g_thread_watcher_list_); | 67 EXPECT_FALSE(ThreadWatcherList::g_thread_watcher_list_); |
68 | 68 |
69 // And again the last transition, STOPPED -> STARTED. | 69 // And again the last transition, STOPPED -> STARTED. |
70 NotifyApplicationStateChange( | 70 NotifyApplicationStateChange( |
71 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 71 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
72 EXPECT_TRUE(ThreadWatcherList::g_thread_watcher_list_); | 72 EXPECT_TRUE(ThreadWatcherList::g_thread_watcher_list_); |
73 } | 73 } |
OLD | NEW |