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

Side by Side Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 extension_service(); 199 extension_service();
200 200
201 // Install low-permission version of the extension. 201 // Install low-permission version of the extension.
202 ASSERT_TRUE(InstallExtension(path_v1, 1)); 202 ASSERT_TRUE(InstallExtension(path_v1, 1));
203 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); 203 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL);
204 204
205 // Update to a high-permission version - it should get disabled. 205 // Update to a high-permission version - it should get disabled.
206 EXPECT_FALSE(UpdateExtension(kId, path_v2, -1)); 206 EXPECT_FALSE(UpdateExtension(kId, path_v2, -1));
207 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); 207 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL);
208 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); 208 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL);
209 EXPECT_TRUE( 209 EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile())->
210 service->extension_prefs()->DidExtensionEscalatePermissions(kId)); 210 DidExtensionEscalatePermissions(kId));
211 } 211 }
212 212
213 void SetEnabled(bool enabled, bool user_gesture, 213 void SetEnabled(bool enabled, bool user_gesture,
214 const std::string& expected_error) { 214 const std::string& expected_error) {
215 scoped_refptr<ManagementSetEnabledFunction> function( 215 scoped_refptr<ManagementSetEnabledFunction> function(
216 new ManagementSetEnabledFunction); 216 new ManagementSetEnabledFunction);
217 const char* enabled_string = enabled ? "true" : "false"; 217 const char* enabled_string = enabled ? "true" : "false";
218 if (user_gesture) 218 if (user_gesture)
219 function->set_user_gesture(true); 219 function->set_user_gesture(true);
220 bool response = util::RunFunction( 220 bool response = util::RunFunction(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // extension should be reloaded and enabled. 281 // extension should be reloaded and enabled.
282 ASSERT_TRUE(CrashEnabledExtension(kId)); 282 ASSERT_TRUE(CrashEnabledExtension(kId));
283 SetEnabled(false, true, std::string()); 283 SetEnabled(false, true, std::string());
284 SetEnabled(true, true, std::string()); 284 SetEnabled(true, true, std::string());
285 const Extension* extension = ExtensionSystem::Get(browser()->profile()) 285 const Extension* extension = ExtensionSystem::Get(browser()->profile())
286 ->extension_service()->GetExtensionById(kId, false); 286 ->extension_service()->GetExtensionById(kId, false);
287 EXPECT_TRUE(extension); 287 EXPECT_TRUE(extension);
288 } 288 }
289 289
290 } // namespace extensions 290 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698