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

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

Issue 946643002: Use PowerSaveBlocker for audio and video on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply nits Created 5 years, 10 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
« no previous file with comments | « extensions/browser/api/power/power_api_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 Request request = requests_.front(); 85 Request request = requests_.front();
86 requests_.pop_front(); 86 requests_.pop_front();
87 return request; 87 return request;
88 } 88 }
89 89
90 private: 90 private:
91 // Creates a new PowerSaveBlockerStub of type |type|. 91 // Creates a new PowerSaveBlockerStub of type |type|.
92 scoped_ptr<content::PowerSaveBlocker> CreateStub( 92 scoped_ptr<content::PowerSaveBlocker> CreateStub(
93 content::PowerSaveBlocker::PowerSaveBlockerType type, 93 content::PowerSaveBlocker::PowerSaveBlockerType type,
94 const std::string& reason) { 94 content::PowerSaveBlocker::Reason reason,
95 const std::string& description) {
95 Request unblock_request = NONE; 96 Request unblock_request = NONE;
96 switch (type) { 97 switch (type) {
97 case content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension: 98 case content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension:
98 requests_.push_back(BLOCK_APP_SUSPENSION); 99 requests_.push_back(BLOCK_APP_SUSPENSION);
99 unblock_request = UNBLOCK_APP_SUSPENSION; 100 unblock_request = UNBLOCK_APP_SUSPENSION;
100 break; 101 break;
101 case content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep: 102 case content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep:
102 requests_.push_back(BLOCK_DISPLAY_SLEEP); 103 requests_.push_back(BLOCK_DISPLAY_SLEEP);
103 unblock_request = UNBLOCK_DISPLAY_SLEEP; 104 unblock_request = UNBLOCK_DISPLAY_SLEEP;
104 break; 105 break;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 269 EXPECT_EQ(NONE, manager_->PopFirstRequest());
269 270
270 // Make the first extension block display-sleep again. 271 // Make the first extension block display-sleep again.
271 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension())); 272 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension()));
272 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 273 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
273 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); 274 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
274 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 275 EXPECT_EQ(NONE, manager_->PopFirstRequest());
275 } 276 }
276 277
277 } // namespace extensions 278 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/power/power_api_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698