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