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

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

Issue 569493003: Remove CreateEmptyExtension from extension_function_test_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 TEST_F(PowerApiTest, MultipleExtensions) { 252 TEST_F(PowerApiTest, MultipleExtensions) {
253 // Simulate an extension blocking the display from sleeping. 253 // Simulate an extension blocking the display from sleeping.
254 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); 254 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension()));
255 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 255 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
256 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 256 EXPECT_EQ(NONE, manager_->PopFirstRequest());
257 257
258 // Create a second extension that blocks system suspend. No additional 258 // Create a second extension that blocks system suspend. No additional
259 // PowerSaveBlocker is needed; the blocker from the first extension 259 // PowerSaveBlocker is needed; the blocker from the first extension
260 // already covers the behavior requested by the second extension. 260 // already covers the behavior requested by the second extension.
261 scoped_refptr<Extension> extension2(test_util::CreateExtensionWithID("id2")); 261 scoped_refptr<Extension> extension2(test_util::CreateEmptyExtension("id2"));
262 ASSERT_TRUE(CallFunction(REQUEST, kSystemArgs, extension2.get())); 262 ASSERT_TRUE(CallFunction(REQUEST, kSystemArgs, extension2.get()));
263 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 263 EXPECT_EQ(NONE, manager_->PopFirstRequest());
264 264
265 // When the first extension is unloaded, a new app-suspension blocker 265 // When the first extension is unloaded, a new app-suspension blocker
266 // should be created before the display-sleep blocker is destroyed. 266 // should be created before the display-sleep blocker is destroyed.
267 UnloadExtension(extension()); 267 UnloadExtension(extension());
268 EXPECT_EQ(BLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); 268 EXPECT_EQ(BLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
269 EXPECT_EQ(UNBLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 269 EXPECT_EQ(UNBLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
270 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 270 EXPECT_EQ(NONE, manager_->PopFirstRequest());
271 271
272 // Make the first extension block display-sleep again. 272 // Make the first extension block display-sleep again.
273 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); 273 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension()));
274 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 274 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
275 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); 275 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
276 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 276 EXPECT_EQ(NONE, manager_->PopFirstRequest());
277 } 277 }
278 278
279 } // namespace extensions 279 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_apitest.cc ('k') | extensions/browser/extension_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698