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

Side by Side Diff: extensions/browser/api/power/power_api_unittest.cc

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/power/power_api.h" 5 #include "extensions/browser/api/power/power_api.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 new PowerReleaseKeepAwakeFunction)); 167 new PowerReleaseKeepAwakeFunction));
168 function->set_extension(extension); 168 function->set_extension(extension);
169 return api_test_utils::RunFunction(function.get(), args, browser_context()); 169 return api_test_utils::RunFunction(function.get(), args, browser_context());
170 } 170 }
171 171
172 // Send a notification to PowerAPI saying that |extension| has 172 // Send a notification to PowerAPI saying that |extension| has
173 // been unloaded. 173 // been unloaded.
174 void UnloadExtension(const extensions::Extension* extension) { 174 void UnloadExtension(const extensions::Extension* extension) {
175 PowerAPI::Get(browser_context()) 175 PowerAPI::Get(browser_context())
176 ->OnExtensionUnloaded(browser_context(), extension, 176 ->OnExtensionUnloaded(browser_context(), extension,
177 UnloadedExtensionInfo::REASON_UNINSTALL); 177 UnloadedExtensionReason::UNINSTALL);
178 } 178 }
179 179
180 std::unique_ptr<PowerSaveBlockerStubManager> manager_; 180 std::unique_ptr<PowerSaveBlockerStubManager> manager_;
181 }; 181 };
182 182
183 TEST_F(PowerAPITest, RequestAndRelease) { 183 TEST_F(PowerAPITest, RequestAndRelease) {
184 // Simulate an extension making and releasing a "display" request and a 184 // Simulate an extension making and releasing a "display" request and a
185 // "system" request. 185 // "system" request.
186 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); 186 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension()));
187 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 187 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 277 EXPECT_EQ(NONE, manager_->PopFirstRequest());
278 278
279 // Make the first extension block display-sleep again. 279 // Make the first extension block display-sleep again.
280 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); 280 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension()));
281 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 281 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
282 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); 282 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
283 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 283 EXPECT_EQ(NONE, manager_->PopFirstRequest());
284 } 284 }
285 285
286 } // namespace extensions 286 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/power/power_api.cc ('k') | extensions/browser/api/printer_provider/printer_provider_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698