OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extension_event_observer.h" | 5 #include "chrome/browser/chromeos/power/extension_event_observer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ~ExtensionEventObserverTest() override { | 57 ~ExtensionEventObserverTest() override { |
58 extension_event_observer_.reset(); | 58 extension_event_observer_.reset(); |
59 profile_manager_.reset(); | 59 profile_manager_.reset(); |
60 DBusThreadManager::Shutdown(); | 60 DBusThreadManager::Shutdown(); |
61 } | 61 } |
62 | 62 |
63 // ::testing::Test overrides. | 63 // ::testing::Test overrides. |
64 void SetUp() override { | 64 void SetUp() override { |
65 ::testing::Test::SetUp(); | 65 ::testing::Test::SetUp(); |
66 | 66 |
67 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 67 gfx::Screen::SetScreenInstance(test_screen_.get()); |
68 | 68 |
69 // Must be called from ::testing::Test::SetUp. | 69 // Must be called from ::testing::Test::SetUp. |
70 ASSERT_TRUE(profile_manager_->SetUp()); | 70 ASSERT_TRUE(profile_manager_->SetUp()); |
71 | 71 |
72 const char kUserProfile[] = "profile1@example.com"; | 72 const char kUserProfile[] = "profile1@example.com"; |
73 const AccountId account_id(AccountId::FromUserEmail(kUserProfile)); | 73 const AccountId account_id(AccountId::FromUserEmail(kUserProfile)); |
74 fake_user_manager_->AddUser(account_id); | 74 fake_user_manager_->AddUser(account_id); |
75 fake_user_manager_->LoginUser(account_id); | 75 fake_user_manager_->LoginUser(account_id); |
76 profile_ = | 76 profile_ = |
77 profile_manager_->CreateTestingProfile(account_id.GetUserEmail()); | 77 profile_manager_->CreateTestingProfile(account_id.GetUserEmail()); |
78 | 78 |
79 profile_manager_->SetLoggedIn(true); | 79 profile_manager_->SetLoggedIn(true); |
80 } | 80 } |
81 void TearDown() override { | 81 void TearDown() override { |
82 profile_ = NULL; | 82 profile_ = NULL; |
83 profile_manager_->DeleteAllTestingProfiles(); | 83 profile_manager_->DeleteAllTestingProfiles(); |
84 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr); | 84 gfx::Screen::SetScreenInstance(nullptr); |
85 ::testing::Test::TearDown(); | 85 ::testing::Test::TearDown(); |
86 } | 86 } |
87 | 87 |
88 protected: | 88 protected: |
89 scoped_refptr<extensions::Extension> CreateApp(const std::string& name, | 89 scoped_refptr<extensions::Extension> CreateApp(const std::string& name, |
90 bool uses_gcm) { | 90 bool uses_gcm) { |
91 scoped_refptr<extensions::Extension> app = | 91 scoped_refptr<extensions::Extension> app = |
92 extensions::ExtensionBuilder() | 92 extensions::ExtensionBuilder() |
93 .SetManifest(std::move( | 93 .SetManifest(std::move( |
94 extensions::DictionaryBuilder() | 94 extensions::DictionaryBuilder() |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback()); | 323 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback()); |
324 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); | 324 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); |
325 | 325 |
326 // Test that the ExtensionEventObserver does not delay suspend attempts when | 326 // Test that the ExtensionEventObserver does not delay suspend attempts when |
327 // it is disabled. | 327 // it is disabled. |
328 power_manager_client_->SendDarkSuspendImminent(); | 328 power_manager_client_->SendDarkSuspendImminent(); |
329 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); | 329 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); |
330 } | 330 } |
331 | 331 |
332 } // namespace chromeos | 332 } // namespace chromeos |
OLD | NEW |