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

Side by Side Diff: chrome/browser/chromeos/policy/power_policy_browsertest.cc

Issue 958313002: [CleanUp] Move PowerApiManager to power_api and Rename (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename to PowerAPI Created 5 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
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "components/policy/core/common/cloud/cloud_policy_core.h" 42 #include "components/policy/core/common/cloud/cloud_policy_core.h"
43 #include "components/policy/core/common/cloud/cloud_policy_store.h" 43 #include "components/policy/core/common/cloud/cloud_policy_store.h"
44 #include "components/policy/core/common/cloud/policy_builder.h" 44 #include "components/policy/core/common/cloud/policy_builder.h"
45 #include "components/policy/core/common/external_data_fetcher.h" 45 #include "components/policy/core/common/external_data_fetcher.h"
46 #include "components/policy/core/common/mock_policy_service.h" 46 #include "components/policy/core/common/mock_policy_service.h"
47 #include "components/policy/core/common/policy_service.h" 47 #include "components/policy/core/common/policy_service.h"
48 #include "content/public/browser/notification_details.h" 48 #include "content/public/browser/notification_details.h"
49 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/notification_source.h" 50 #include "content/public/browser/notification_source.h"
51 #include "content/public/test/test_utils.h" 51 #include "content/public/test/test_utils.h"
52 #include "extensions/browser/api/power/power_api_manager.h" 52 #include "extensions/browser/api/power/power_api.h"
53 #include "extensions/common/api/power.h" 53 #include "extensions/common/api/power.h"
54 #include "policy/proto/device_management_backend.pb.h" 54 #include "policy/proto/device_management_backend.pb.h"
55 #include "testing/gmock/include/gmock/gmock.h" 55 #include "testing/gmock/include/gmock/gmock.h"
56 #include "testing/gtest/include/gtest/gtest.h" 56 #include "testing/gtest/include/gtest/gtest.h"
57 57
58 namespace em = enterprise_management; 58 namespace em = enterprise_management;
59 namespace pm = power_manager; 59 namespace pm = power_manager;
60 60
61 using ::testing::AnyNumber; 61 using ::testing::AnyNumber;
62 using ::testing::InvokeWithoutArgs; 62 using ::testing::InvokeWithoutArgs;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
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::PowerApiManager::Get(browser()->profile())->AddRequest( 485 extensions::PowerAPI::Get(browser()->profile())
486 kExtensionId, extensions::core_api::power::LEVEL_DISPLAY); 486 ->AddRequest(kExtensionId, extensions::core_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
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
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_browsertest.cc ('k') | chrome/browser/extensions/browser_context_keyed_service_factories.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698