| 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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "sync/api/string_ordinal.h" | 48 #include "sync/api/string_ordinal.h" |
| 49 | 49 |
| 50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
| 51 #include "chromeos/chromeos_switches.h" | 51 #include "chromeos/chromeos_switches.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 using extensions::Extension; | 54 using extensions::Extension; |
| 55 using extensions::ExtensionCreator; | 55 using extensions::ExtensionCreator; |
| 56 using extensions::FeatureSwitch; | 56 using extensions::FeatureSwitch; |
| 57 using extensions::Manifest; | 57 using extensions::Manifest; |
| 58 using extensions::UninstalledExtensionInfo; |
| 58 | 59 |
| 59 ExtensionBrowserTest::ExtensionBrowserTest() | 60 ExtensionBrowserTest::ExtensionBrowserTest() |
| 60 : loaded_(false), | 61 : loaded_(false), |
| 61 installed_(false), | 62 installed_(false), |
| 62 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
| 63 set_chromeos_user_(true), | 64 set_chromeos_user_(true), |
| 64 #endif | 65 #endif |
| 65 // Default channel is STABLE but override with UNKNOWN so that unlaunched | 66 // Default channel is STABLE but override with UNKNOWN so that unlaunched |
| 66 // or incomplete APIs can write tests. | 67 // or incomplete APIs can write tests. |
| 67 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN), | 68 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN), |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 ExtensionService* service = extensions::ExtensionSystem::Get( | 546 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 546 profile())->extension_service(); | 547 profile())->extension_service(); |
| 547 service->UnloadExtension(extension_id, | 548 service->UnloadExtension(extension_id, |
| 548 extensions::UnloadedExtensionInfo::REASON_DISABLE); | 549 extensions::UnloadedExtensionInfo::REASON_DISABLE); |
| 549 } | 550 } |
| 550 | 551 |
| 551 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { | 552 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { |
| 552 ExtensionService* service = extensions::ExtensionSystem::Get( | 553 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 553 profile())->extension_service(); | 554 profile())->extension_service(); |
| 554 service->UninstallExtension( | 555 service->UninstallExtension( |
| 555 extension_id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); | 556 extension_id, UninstalledExtensionInfo::REASON_FOR_TESTING, NULL); |
| 556 } | 557 } |
| 557 | 558 |
| 558 void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) { | 559 void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) { |
| 559 ExtensionService* service = extensions::ExtensionSystem::Get( | 560 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 560 profile())->extension_service(); | 561 profile())->extension_service(); |
| 561 service->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); | 562 service->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); |
| 562 } | 563 } |
| 563 | 564 |
| 564 void ExtensionBrowserTest::EnableExtension(const std::string& extension_id) { | 565 void ExtensionBrowserTest::EnableExtension(const std::string& extension_id) { |
| 565 ExtensionService* service = extensions::ExtensionSystem::Get( | 566 ExtensionService* service = extensions::ExtensionSystem::Get( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( | 643 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( |
| 643 profile(), extension_id, script); | 644 profile(), extension_id, script); |
| 644 } | 645 } |
| 645 | 646 |
| 646 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( | 647 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( |
| 647 const std::string& extension_id, | 648 const std::string& extension_id, |
| 648 const std::string& script) { | 649 const std::string& script) { |
| 649 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( | 650 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( |
| 650 profile(), extension_id, script); | 651 profile(), extension_id, script); |
| 651 } | 652 } |
| OLD | NEW |