| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // Default settings should have delays. | 476 // Default settings should have delays. |
| 477 pm::PowerManagementPolicy power_management_policy = baseline_policy; | 477 pm::PowerManagementPolicy power_management_policy = baseline_policy; |
| 478 EXPECT_NE(0, baseline_policy.ac_delays().screen_dim_ms()); | 478 EXPECT_NE(0, baseline_policy.ac_delays().screen_dim_ms()); |
| 479 EXPECT_NE(0, baseline_policy.ac_delays().screen_off_ms()); | 479 EXPECT_NE(0, baseline_policy.ac_delays().screen_off_ms()); |
| 480 EXPECT_NE(0, baseline_policy.battery_delays().screen_dim_ms()); | 480 EXPECT_NE(0, baseline_policy.battery_delays().screen_dim_ms()); |
| 481 EXPECT_NE(0, baseline_policy.battery_delays().screen_off_ms()); | 481 EXPECT_NE(0, baseline_policy.battery_delays().screen_off_ms()); |
| 482 | 482 |
| 483 // Pretend an extension grabs a screen wake lock. | 483 // Pretend an extension grabs a screen wake lock. |
| 484 const char kExtensionId[] = "abcdefghijklmnopabcdefghijlkmnop"; | 484 const char kExtensionId[] = "abcdefghijklmnopabcdefghijlkmnop"; |
| 485 extensions::PowerAPI::Get(browser()->profile()) | 485 extensions::PowerAPI::Get(browser()->profile()) |
| 486 ->AddRequest(kExtensionId, extensions::core_api::power::LEVEL_DISPLAY); | 486 ->AddRequest(kExtensionId, extensions::api::power::LEVEL_DISPLAY); |
| 487 base::RunLoop().RunUntilIdle(); | 487 base::RunLoop().RunUntilIdle(); |
| 488 | 488 |
| 489 // Check that the lock is in effect (ignoring ac_idle_action, | 489 // Check that the lock is in effect (ignoring ac_idle_action, |
| 490 // battery_idle_action and reason). | 490 // battery_idle_action and reason). |
| 491 pm::PowerManagementPolicy policy = baseline_policy; | 491 pm::PowerManagementPolicy policy = baseline_policy; |
| 492 policy.mutable_ac_delays()->set_screen_dim_ms(0); | 492 policy.mutable_ac_delays()->set_screen_dim_ms(0); |
| 493 policy.mutable_ac_delays()->set_screen_off_ms(0); | 493 policy.mutable_ac_delays()->set_screen_off_ms(0); |
| 494 policy.mutable_battery_delays()->set_screen_dim_ms(0); | 494 policy.mutable_battery_delays()->set_screen_dim_ms(0); |
| 495 policy.mutable_battery_delays()->set_screen_off_ms(0); | 495 policy.mutable_battery_delays()->set_screen_off_ms(0); |
| 496 policy.set_ac_idle_action( | 496 policy.set_ac_idle_action( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 507 policy = baseline_policy; | 507 policy = baseline_policy; |
| 508 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); | 508 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); |
| 509 policy.set_battery_idle_action( | 509 policy.set_battery_idle_action( |
| 510 power_manager_client_->policy().battery_idle_action()); | 510 power_manager_client_->policy().battery_idle_action()); |
| 511 policy.set_reason(power_manager_client_->policy().reason()); | 511 policy.set_reason(power_manager_client_->policy().reason()); |
| 512 EXPECT_EQ(GetDebugString(policy), | 512 EXPECT_EQ(GetDebugString(policy), |
| 513 GetDebugString(power_manager_client_->policy())); | 513 GetDebugString(power_manager_client_->policy())); |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace policy | 516 } // namespace policy |
| OLD | NEW |