| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" | 14 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" |
| 15 #include "chrome/browser/devtools/devtools_window.h" | 15 #include "chrome/browser/devtools/devtools_window.h" |
| 16 #include "chrome/browser/extensions/extension_browsertest.h" | 16 #include "chrome/browser/extensions/extension_browsertest.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/extension_system.h" | 18 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/extensions/unpacked_installer.h" | 19 #include "chrome/browser/extensions/unpacked_installer.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/extensions/api/content_scripts/content_scripts_handler.h
" |
| 28 #include "chrome/common/extensions/manifest_handler.h" |
| 27 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 30 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
| 30 #include "content/public/browser/child_process_data.h" | 32 #include "content/public/browser/child_process_data.h" |
| 31 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
| 32 #include "content/public/browser/devtools_agent_host.h" | 34 #include "content/public/browser/devtools_agent_host.h" |
| 33 #include "content/public/browser/devtools_client_host.h" | 35 #include "content/public/browser/devtools_client_host.h" |
| 34 #include "content/public/browser/devtools_http_handler.h" | 36 #include "content/public/browser/devtools_http_handler.h" |
| 35 #include "content/public/browser/devtools_manager.h" | 37 #include "content/public/browser/devtools_manager.h" |
| 36 #include "content/public/browser/notification_registrar.h" | 38 #include "content/public/browser/notification_registrar.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 class DevToolsExtensionTest : public DevToolsSanityTest, | 181 class DevToolsExtensionTest : public DevToolsSanityTest, |
| 180 public content::NotificationObserver { | 182 public content::NotificationObserver { |
| 181 public: | 183 public: |
| 182 DevToolsExtensionTest() : DevToolsSanityTest() { | 184 DevToolsExtensionTest() : DevToolsSanityTest() { |
| 183 PathService::Get(chrome::DIR_TEST_DATA, &test_extensions_dir_); | 185 PathService::Get(chrome::DIR_TEST_DATA, &test_extensions_dir_); |
| 184 test_extensions_dir_ = test_extensions_dir_.AppendASCII("devtools"); | 186 test_extensions_dir_ = test_extensions_dir_.AppendASCII("devtools"); |
| 185 test_extensions_dir_ = test_extensions_dir_.AppendASCII("extensions"); | 187 test_extensions_dir_ = test_extensions_dir_.AppendASCII("extensions"); |
| 186 } | 188 } |
| 187 | 189 |
| 188 protected: | 190 protected: |
| 191 virtual void SetUpOnMainThread() OVERRIDE { |
| 192 DevToolsSanityTest::SetUpOnMainThread(); |
| 193 (new extensions::ContentScriptsHandler)->Register(); |
| 194 } |
| 195 |
| 196 virtual void CleanUpOnMainThread() OVERRIDE { |
| 197 extensions::ManifestHandler::ClearRegistryForTesting(); |
| 198 DevToolsSanityTest::CleanUpOnMainThread(); |
| 199 } |
| 200 |
| 189 // Load an extension from test\data\devtools\extensions\<extension_name> | 201 // Load an extension from test\data\devtools\extensions\<extension_name> |
| 190 void LoadExtension(const char* extension_name) { | 202 void LoadExtension(const char* extension_name) { |
| 191 base::FilePath path = test_extensions_dir_.AppendASCII(extension_name); | 203 base::FilePath path = test_extensions_dir_.AppendASCII(extension_name); |
| 192 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; | 204 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; |
| 193 } | 205 } |
| 194 | 206 |
| 195 private: | 207 private: |
| 196 bool LoadExtensionFromPath(const base::FilePath& path) { | 208 bool LoadExtensionFromPath(const base::FilePath& path) { |
| 197 ExtensionService* service = extensions::ExtensionSystem::Get( | 209 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 198 browser()->profile())->extension_service(); | 210 browser()->profile())->extension_service(); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 devtools_http_handler_->Stop(); | 697 devtools_http_handler_->Stop(); |
| 686 return result; | 698 return result; |
| 687 } | 699 } |
| 688 }; | 700 }; |
| 689 | 701 |
| 690 IN_PROC_BROWSER_TEST_F(DISABLED_RemoteDebuggingTest, TargetList) { | 702 IN_PROC_BROWSER_TEST_F(DISABLED_RemoteDebuggingTest, TargetList) { |
| 691 ASSERT_TRUE(RunExtensionTest("target_list")); | 703 ASSERT_TRUE(RunExtensionTest("target_list")); |
| 692 } | 704 } |
| 693 | 705 |
| 694 } // namespace | 706 } // namespace |
| OLD | NEW |