OLD | NEW |
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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/api/management/management_api.h" | 9 #include "chrome/browser/extensions/api/management/management_api.h" |
10 #include "chrome/browser/extensions/api/management/management_api_constants.h" | 10 #include "chrome/browser/extensions/api/management/management_api_constants.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); | 242 EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); |
243 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); | 243 EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); |
244 EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile()) | 244 EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile()) |
245 ->DidExtensionEscalatePermissions(kId)); | 245 ->DidExtensionEscalatePermissions(kId)); |
246 } | 246 } |
247 | 247 |
248 void SetEnabled(bool enabled, bool user_gesture, | 248 void SetEnabled(bool enabled, bool user_gesture, |
249 const std::string& expected_error) { | 249 const std::string& expected_error) { |
250 scoped_refptr<ManagementSetEnabledFunction> function( | 250 scoped_refptr<ManagementSetEnabledFunction> function( |
251 new ManagementSetEnabledFunction); | 251 new ManagementSetEnabledFunction); |
252 const char* enabled_string = enabled ? "true" : "false"; | 252 const char* const enabled_string = enabled ? "true" : "false"; |
253 if (user_gesture) | 253 if (user_gesture) |
254 function->set_user_gesture(true); | 254 function->set_user_gesture(true); |
255 bool response = util::RunFunction( | 255 bool response = util::RunFunction( |
256 function.get(), | 256 function.get(), |
257 base::StringPrintf("[\"%s\", %s]", kId, enabled_string), | 257 base::StringPrintf("[\"%s\", %s]", kId, enabled_string), |
258 browser(), | 258 browser(), |
259 util::NONE); | 259 util::NONE); |
260 if (expected_error.empty()) { | 260 if (expected_error.empty()) { |
261 EXPECT_EQ(true, response); | 261 EXPECT_EQ(true, response); |
262 } else { | 262 } else { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // extension should be reloaded and enabled. | 316 // extension should be reloaded and enabled. |
317 ASSERT_TRUE(CrashEnabledExtension(kId)); | 317 ASSERT_TRUE(CrashEnabledExtension(kId)); |
318 SetEnabled(false, true, std::string()); | 318 SetEnabled(false, true, std::string()); |
319 SetEnabled(true, true, std::string()); | 319 SetEnabled(true, true, std::string()); |
320 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 320 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
321 ->extension_service()->GetExtensionById(kId, false); | 321 ->extension_service()->GetExtensionById(kId, false); |
322 EXPECT_TRUE(extension); | 322 EXPECT_TRUE(extension); |
323 } | 323 } |
324 | 324 |
325 } // namespace extensions | 325 } // namespace extensions |
OLD | NEW |