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

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

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/api/power/power_api.h" 5 #include "chrome/browser/extensions/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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool CallFunction(FunctionType type, 150 bool CallFunction(FunctionType type,
151 const std::string& args, 151 const std::string& args,
152 extensions::Extension* extension) { 152 extensions::Extension* extension) {
153 scoped_refptr<UIThreadExtensionFunction> function( 153 scoped_refptr<UIThreadExtensionFunction> function(
154 type == REQUEST ? 154 type == REQUEST ?
155 static_cast<UIThreadExtensionFunction*>( 155 static_cast<UIThreadExtensionFunction*>(
156 new PowerRequestKeepAwakeFunction) : 156 new PowerRequestKeepAwakeFunction) :
157 static_cast<UIThreadExtensionFunction*>( 157 static_cast<UIThreadExtensionFunction*>(
158 new PowerReleaseKeepAwakeFunction)); 158 new PowerReleaseKeepAwakeFunction));
159 function->set_extension(extension); 159 function->set_extension(extension);
160 return utils::RunFunction(function, args, browser(), utils::NONE); 160 return utils::RunFunction(function.get(), args, browser(), utils::NONE);
161 } 161 }
162 162
163 // Send a notification to PowerApiManager saying that |extension| has 163 // Send a notification to PowerApiManager saying that |extension| has
164 // been unloaded. 164 // been unloaded.
165 void UnloadExtension(extensions::Extension* extension) { 165 void UnloadExtension(extensions::Extension* extension) {
166 UnloadedExtensionInfo details( 166 UnloadedExtensionInfo details(
167 extension, extension_misc::UNLOAD_REASON_UNINSTALL); 167 extension, extension_misc::UNLOAD_REASON_UNINSTALL);
168 PowerApiManager::GetInstance()->Observe( 168 PowerApiManager::GetInstance()->Observe(
169 chrome::NOTIFICATION_EXTENSION_UNLOADED, 169 chrome::NOTIFICATION_EXTENSION_UNLOADED,
170 content::Source<Profile>(browser()->profile()), 170 content::Source<Profile>(browser()->profile()),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 276 EXPECT_EQ(NONE, manager_->PopFirstRequest());
277 277
278 // Make the first extension block display-sleep again. 278 // Make the first extension block display-sleep again.
279 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension_.get())); 279 ASSERT_TRUE(CallFunction(REQUEST, kDisplayArgs, extension_.get()));
280 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest()); 280 EXPECT_EQ(BLOCK_DISPLAY_SLEEP, manager_->PopFirstRequest());
281 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest()); 281 EXPECT_EQ(UNBLOCK_APP_SUSPENSION, manager_->PopFirstRequest());
282 EXPECT_EQ(NONE, manager_->PopFirstRequest()); 282 EXPECT_EQ(NONE, manager_->PopFirstRequest());
283 } 283 }
284 284
285 } // namespace extensions 285 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698