OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <X11/extensions/XTest.h> | 8 #include <X11/extensions/XTest.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 ExpectMetric("Dummy.MetricOnBattery", 3, 1, 100, 50); | 330 ExpectMetric("Dummy.MetricOnBattery", 3, 1, 100, 50); |
331 EXPECT_TRUE(daemon_.SendMetricWithPowerState("Dummy.Metric", /* sample */ 3, | 331 EXPECT_TRUE(daemon_.SendMetricWithPowerState("Dummy.Metric", /* sample */ 3, |
332 /* min */ 1, /* max */ 100, /* buckets */ 50)); | 332 /* min */ 1, /* max */ 100, /* buckets */ 50)); |
333 daemon_.plugged_state_ = daemon_.kPowerConnected; | 333 daemon_.plugged_state_ = daemon_.kPowerConnected; |
334 ExpectMetric("Dummy.MetricOnAC", 3, 1, 100, 50); | 334 ExpectMetric("Dummy.MetricOnAC", 3, 1, 100, 50); |
335 EXPECT_TRUE(daemon_.SendMetricWithPowerState("Dummy.Metric", /* sample */ 3, | 335 EXPECT_TRUE(daemon_.SendMetricWithPowerState("Dummy.Metric", /* sample */ 3, |
336 /* min */ 1, /* max */ 100, /* buckets */ 50)); | 336 /* min */ 1, /* max */ 100, /* buckets */ 50)); |
337 } | 337 } |
338 | 338 |
339 static gboolean QuitLoop(gpointer data) { | 339 static gboolean QuitLoop(gpointer data) { |
340 GMainLoop *loop = static_cast<GMainLoop*>(data); | 340 GMainLoop* loop = static_cast<GMainLoop*>(data); |
341 g_main_loop_quit(loop); | 341 g_main_loop_quit(loop); |
342 return false; | 342 return false; |
343 } | 343 } |
344 | 344 |
345 TEST_F(DaemonTest, GenerateMetricsOnIdleEvent) { | 345 TEST_F(DaemonTest, GenerateMetricsOnIdleEvent) { |
346 { | 346 { |
347 InSequence metrics; | 347 InSequence metrics; |
348 EXPECT_CALL(backlight_, SetBrightness(kUnpluggedBrightness)) | 348 EXPECT_CALL(backlight_, SetBrightness(kUnpluggedBrightness)) |
349 .WillOnce(Return(true)); | 349 .WillOnce(Return(true)); |
350 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) | 350 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) | 442 EXPECT_CALL(backlight_, GetBrightness(NotNull(), NotNull())) |
443 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness), | 443 .WillOnce(DoAll(SetArgumentPointee<0>(kDefaultBrightness), |
444 SetArgumentPointee<1>(kMaxBrightness), | 444 SetArgumentPointee<1>(kMaxBrightness), |
445 Return(true))); | 445 Return(true))); |
446 ExpectEnumMetric("Power.BacklightLevelOnAC", | 446 ExpectEnumMetric("Power.BacklightLevelOnAC", |
447 kDefaultBrightness, kMaxBrightness); | 447 kDefaultBrightness, kMaxBrightness); |
448 daemon_.GenerateBacklightLevelMetric(&daemon_); | 448 daemon_.GenerateBacklightLevelMetric(&daemon_); |
449 } | 449 } |
450 | 450 |
451 } // namespace power_manager | 451 } // namespace power_manager |
OLD | NEW |