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 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
8 #include "content/browser/power_profiler/power_profiler_service.h" | 8 #include "content/browser/power_profiler/power_profiler_service.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 void RemoveObserverTest() { | 105 void RemoveObserverTest() { |
106 service_->RemoveObserver(&observer_); | 106 service_->RemoveObserver(&observer_); |
107 | 107 |
108 // Received |kNumEvents| events. | 108 // Received |kNumEvents| events. |
109 EXPECT_EQ(observer_.valid_event_count(), kNumEvents); | 109 EXPECT_EQ(observer_.valid_event_count(), kNumEvents); |
110 } | 110 } |
111 | 111 |
112 protected: | 112 protected: |
113 PowerProfilerServiceTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} | 113 PowerProfilerServiceTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} |
114 virtual ~PowerProfilerServiceTest() {} | 114 ~PowerProfilerServiceTest() override {} |
115 | 115 |
116 void RegisterQuitClosure(base::Closure closure) { | 116 void RegisterQuitClosure(base::Closure closure) { |
117 observer_.set_quit_closure(closure); | 117 observer_.set_quit_closure(closure); |
118 } | 118 } |
119 | 119 |
120 private: | 120 private: |
121 scoped_ptr<PowerProfilerService> service_; | 121 scoped_ptr<PowerProfilerService> service_; |
122 TestPowerProfilerObserver observer_; | 122 TestPowerProfilerObserver observer_; |
123 | 123 |
124 // UI thread. | 124 // UI thread. |
(...skipping 11 matching lines...) Expand all Loading... |
136 | 136 |
137 ServiceStartTest(); | 137 ServiceStartTest(); |
138 AddObserverTest(); | 138 AddObserverTest(); |
139 | 139 |
140 run_loop.Run(); | 140 run_loop.Run(); |
141 | 141 |
142 RemoveObserverTest(); | 142 RemoveObserverTest(); |
143 } | 143 } |
144 | 144 |
145 } // namespace content | 145 } // namespace content |
OLD | NEW |