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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 profile_manager_->DeleteAllTestingProfiles(); | 83 profile_manager_->DeleteAllTestingProfiles(); |
84 gfx::Screen::SetScreenInstance(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( |
94 extensions::DictionaryBuilder() | 94 extensions::DictionaryBuilder() |
95 .Set("name", name) | 95 .Set("name", name) |
96 .Set("version", "1.0.0") | 96 .Set("version", "1.0.0") |
97 .Set("manifest_version", 2) | 97 .Set("manifest_version", 2) |
98 .Set("app", | 98 .Set("app", extensions::DictionaryBuilder() |
99 std::move(extensions::DictionaryBuilder().Set( | 99 .Set("background", |
100 "background", | 100 extensions::DictionaryBuilder() |
101 std::move(extensions::DictionaryBuilder().Set( | 101 .Set("scripts", |
102 "scripts", | 102 extensions::ListBuilder() |
103 std::move(extensions::ListBuilder().Append( | 103 .Append("background.js") |
104 "background.js"))))))) | 104 .Build()) |
105 .Set("permissions", | 105 .Build()) |
106 std::move(extensions::ListBuilder().Append( | 106 .Build()) |
107 uses_gcm ? "gcm" : ""))))) | 107 .Set("permissions", extensions::ListBuilder() |
| 108 .Append(uses_gcm ? "gcm" : "") |
| 109 .Build()) |
| 110 .Build()) |
108 .Build(); | 111 .Build(); |
109 | 112 |
110 created_apps_.push_back(app); | 113 created_apps_.push_back(app); |
111 | 114 |
112 return app; | 115 return app; |
113 } | 116 } |
114 | 117 |
115 extensions::ExtensionHost* CreateHostForApp(Profile* profile, | 118 extensions::ExtensionHost* CreateHostForApp(Profile* profile, |
116 extensions::Extension* app) { | 119 extensions::Extension* app) { |
117 extensions::ProcessManager::Get(profile)->CreateBackgroundHost( | 120 extensions::ProcessManager::Get(profile)->CreateBackgroundHost( |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback()); | 326 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback()); |
324 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); | 327 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); |
325 | 328 |
326 // Test that the ExtensionEventObserver does not delay suspend attempts when | 329 // Test that the ExtensionEventObserver does not delay suspend attempts when |
327 // it is disabled. | 330 // it is disabled. |
328 power_manager_client_->SendDarkSuspendImminent(); | 331 power_manager_client_->SendDarkSuspendImminent(); |
329 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); | 332 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); |
330 } | 333 } |
331 | 334 |
332 } // namespace chromeos | 335 } // namespace chromeos |
OLD | NEW |