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/run_loop.h" | 6 #include "base/run_loop.h" |
6 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
7 #include "content/browser/power_profiler/power_profiler_service.h" | 8 #include "content/browser/power_profiler/power_profiler_service.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 namespace content { | 11 namespace content { |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 const int kNumEvents = 3; | 15 const int kNumEvents = 3; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 }; | 83 }; |
83 | 84 |
84 } // namespace | 85 } // namespace |
85 | 86 |
86 class PowerProfilerServiceTest : public testing::Test { | 87 class PowerProfilerServiceTest : public testing::Test { |
87 public: | 88 public: |
88 void ServiceStartTest() { | 89 void ServiceStartTest() { |
89 service_.reset(new PowerProfilerService( | 90 service_.reset(new PowerProfilerService( |
90 make_scoped_ptr<PowerDataProvider>( | 91 make_scoped_ptr<PowerDataProvider>( |
91 new TestPowerDataProvider(kNumEvents)), | 92 new TestPowerDataProvider(kNumEvents)), |
92 message_loop_.task_runner(), base::TimeDelta::FromMilliseconds(1))); | 93 message_loop_.message_loop_proxy(), |
| 94 base::TimeDelta::FromMilliseconds(1))); |
93 EXPECT_TRUE(service_->IsAvailable()); | 95 EXPECT_TRUE(service_->IsAvailable()); |
94 } | 96 } |
95 | 97 |
96 void AddObserverTest() { | 98 void AddObserverTest() { |
97 service_->AddObserver(&observer_); | 99 service_->AddObserver(&observer_); |
98 | 100 |
99 // No PowerEvents received. | 101 // No PowerEvents received. |
100 EXPECT_EQ(observer_.valid_event_count(), 0); | 102 EXPECT_EQ(observer_.valid_event_count(), 0); |
101 } | 103 } |
102 | 104 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 136 |
135 ServiceStartTest(); | 137 ServiceStartTest(); |
136 AddObserverTest(); | 138 AddObserverTest(); |
137 | 139 |
138 run_loop.Run(); | 140 run_loop.Run(); |
139 | 141 |
140 RemoveObserverTest(); | 142 RemoveObserverTest(); |
141 } | 143 } |
142 | 144 |
143 } // namespace content | 145 } // namespace content |
OLD | NEW |