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

Side by Side Diff: chrome/browser/chromeos/power/peripheral_battery_observer_browsertest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/power/peripheral_battery_observer.h" 5 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 protected: 58 protected:
59 scoped_ptr<PeripheralBatteryObserver> observer_; 59 scoped_ptr<PeripheralBatteryObserver> observer_;
60 60
61 private: 61 private:
62 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest); 62 DISALLOW_COPY_AND_ASSIGN(PeripheralBatteryObserverTest);
63 }; 63 };
64 64
65 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) { 65 IN_PROC_BROWSER_TEST_F(PeripheralBatteryObserverTest, Basic) {
66 base::SimpleTestTickClock clock; 66 base::SimpleTestTickClock clock((base::TimeTicks()));
67 observer_->set_testing_clock(&clock); 67 observer_->set_testing_clock(&clock);
68 68
69 NotificationUIManager* notification_manager = 69 NotificationUIManager* notification_manager =
70 g_browser_process->notification_ui_manager(); 70 g_browser_process->notification_ui_manager();
71 71
72 // Level 50 at time 100, no low-battery notification. 72 // Level 50 at time 100, no low-battery notification.
73 clock.Advance(base::TimeDelta::FromSeconds(100)); 73 clock.Advance(base::TimeDelta::FromSeconds(100));
74 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath, 74 observer_->PeripheralBatteryStatusReceived(kTestBatteryPath,
75 kTestDeviceName, 50); 75 kTestDeviceName, 50);
76 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u); 76 EXPECT_EQ(observer_->batteries_.count(kTestBatteryAddress), 1u);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ProfileManager::GetPrimaryUserProfile())) != NULL); 169 ProfileManager::GetPrimaryUserProfile())) != NULL);
170 170
171 observer_->RemoveBattery(kTestBatteryAddress); 171 observer_->RemoveBattery(kTestBatteryAddress);
172 EXPECT_FALSE(notification_manager->FindById( 172 EXPECT_FALSE(notification_manager->FindById(
173 kTestBatteryAddress, 173 kTestBatteryAddress,
174 NotificationUIManager::GetProfileID( 174 NotificationUIManager::GetProfileID(
175 ProfileManager::GetPrimaryUserProfile())) != NULL); 175 ProfileManager::GetPrimaryUserProfile())) != NULL);
176 } 176 }
177 177
178 } // namespace chromeos 178 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698