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

Side by Side Diff: powerd_unittest.cc

Issue 6715014: Display off is done by a callback into backlight controller (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/power_manager.git
Patch Set: Deleted unused lines, 2010->2011 Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 #include <gdk/gdk.h> 6 #include <gdk/gdk.h>
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <X11/extensions/XTest.h> 9 #include <X11/extensions/XTest.h>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 virtual void SetUp() { 53 virtual void SetUp() {
54 // Tests initialization done by the daemon's constructor. 54 // Tests initialization done by the daemon's constructor.
55 EXPECT_EQ(0, daemon_.battery_discharge_rate_metric_last_); 55 EXPECT_EQ(0, daemon_.battery_discharge_rate_metric_last_);
56 EXPECT_EQ(0, daemon_.battery_remaining_charge_metric_last_); 56 EXPECT_EQ(0, daemon_.battery_remaining_charge_metric_last_);
57 EXPECT_EQ(0, daemon_.battery_time_to_empty_metric_last_); 57 EXPECT_EQ(0, daemon_.battery_time_to_empty_metric_last_);
58 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) 58 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull()))
59 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness), 59 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness),
60 SetArgumentPointee<1>(kMaxBrightness), 60 SetArgumentPointee<1>(kMaxBrightness),
61 Return(true))); 61 Return(true)));
62 EXPECT_CALL(backlight_, SetScreenOffFunc(NotNull(), NotNull()));
62 prefs_.SetInt64(kPluggedBrightnessOffset, kPluggedBrightness); 63 prefs_.SetInt64(kPluggedBrightnessOffset, kPluggedBrightness);
63 prefs_.SetInt64(kUnpluggedBrightnessOffset, kUnpluggedBrightness); 64 prefs_.SetInt64(kUnpluggedBrightnessOffset, kUnpluggedBrightness);
64 prefs_.SetInt64(kAlsBrightnessLevel, kAlsBrightness); 65 prefs_.SetInt64(kAlsBrightnessLevel, kAlsBrightness);
65 CHECK(backlight_ctl_.Init()); 66 CHECK(backlight_ctl_.Init());
66 ResetPowerStatus(status_); 67 ResetPowerStatus(status_);
67 } 68 }
68 69
69 protected: 70 protected:
70 // Adds a metrics library mock expectation that the specified metric 71 // Adds a metrics library mock expectation that the specified metric
71 // will be generated. 72 // will be generated.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) 352 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull()))
352 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness), 353 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness),
353 SetArgumentPointee<1>(kMaxBrightness), 354 SetArgumentPointee<1>(kMaxBrightness),
354 Return(true))); 355 Return(true)));
355 ExpectEnumMetric("Power.BacklightLevelOnAC", 356 ExpectEnumMetric("Power.BacklightLevelOnAC",
356 kDefaultBrightness, kMaxBrightness); 357 kDefaultBrightness, kMaxBrightness);
357 daemon_.GenerateBacklightLevelMetricThunk(&daemon_); 358 daemon_.GenerateBacklightLevelMetricThunk(&daemon_);
358 } 359 }
359 360
360 } // namespace power_manager 361 } // namespace power_manager
OLDNEW
« mock_backlight.h ('K') | « mock_backlight.h ('k') | signal_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698