| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "chrome/browser/extensions/api/management/management_api.h" | 10 #include "chrome/browser/extensions/api/management/management_api.h" |
| 11 #include "chrome/browser/extensions/api/management/management_api_constants.h" | 11 #include "chrome/browser/extensions/api/management/management_api_constants.h" |
| 12 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
| 13 #include "chrome/browser/extensions/extension_function_test_utils.h" | 13 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 14 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" | 16 #include "chrome/browser/extensions/extension_system.h" |
| 17 #include "chrome/browser/extensions/extension_test_message_listener.h" | 17 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (expected_error.empty()) { | 208 if (expected_error.empty()) { |
| 209 EXPECT_EQ(true, response); | 209 EXPECT_EQ(true, response); |
| 210 } else { | 210 } else { |
| 211 EXPECT_TRUE(response == false); | 211 EXPECT_TRUE(response == false); |
| 212 EXPECT_EQ(expected_error, function->GetError()); | 212 EXPECT_EQ(expected_error, function->GetError()); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 private: | 217 private: |
| 218 ScopedTempDir scoped_temp_dir_; | 218 base::ScopedTempDir scoped_temp_dir_; |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 const char ExtensionManagementApiEscalationTest::kId[] = | 221 const char ExtensionManagementApiEscalationTest::kId[] = |
| 222 "pgdpcfcocojkjfbgpiianjngphoopgmo"; | 222 "pgdpcfcocojkjfbgpiianjngphoopgmo"; |
| 223 | 223 |
| 224 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, | 224 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, |
| 225 DisabledReason) { | 225 DisabledReason) { |
| 226 scoped_refptr<GetExtensionByIdFunction> function = | 226 scoped_refptr<GetExtensionByIdFunction> function = |
| 227 new GetExtensionByIdFunction(); | 227 new GetExtensionByIdFunction(); |
| 228 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( | 228 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 255 | 255 |
| 256 // Crash the extension. Mock a reload by disabling and then enabling. The | 256 // Crash the extension. Mock a reload by disabling and then enabling. The |
| 257 // extension should be reloaded and enabled. | 257 // extension should be reloaded and enabled. |
| 258 ASSERT_TRUE(CrashEnabledExtension(kId)); | 258 ASSERT_TRUE(CrashEnabledExtension(kId)); |
| 259 SetEnabled(false, true, ""); | 259 SetEnabled(false, true, ""); |
| 260 SetEnabled(true, true, ""); | 260 SetEnabled(true, true, ""); |
| 261 const extensions::Extension* extension = browser()->profile()-> | 261 const extensions::Extension* extension = browser()->profile()-> |
| 262 GetExtensionService()->GetExtensionById(kId, false); | 262 GetExtensionService()->GetExtensionById(kId, false); |
| 263 EXPECT_TRUE(extension); | 263 EXPECT_TRUE(extension); |
| 264 } | 264 } |
| OLD | NEW |