Chromium Code Reviews| 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/requirements/requirements_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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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: |
| 189 // Load an extension from test\data\devtools\extensions\<extension_name> | 191 // Load an extension from test\data\devtools\extensions\<extension_name> |
| 190 void LoadExtension(const char* extension_name) { | 192 void LoadExtension(const char* extension_name) { |
| 191 base::FilePath path = test_extensions_dir_.AppendASCII(extension_name); | 193 base::FilePath path = test_extensions_dir_.AppendASCII(extension_name); |
| 192 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; | 194 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; |
| 193 } | 195 } |
| 194 | 196 |
| 197 virtual void SetUpOnMainThread() OVERRIDE { | |
| 198 DevToolsSanityTest::SetUpOnMainThread(); | |
| 199 (new extensions::RequirementsHandler)->Register(); | |
|
Yoyo Zhou
2013/03/20 22:41:36
Unless I'm mistaken, you don't need these in brows
Devlin
2013/03/23 22:28:25
You're not mistaken; these are unneeded. I had a
| |
| 200 } | |
| 201 | |
| 202 virtual void CleanUpOnMainThread() OVERRIDE { | |
| 203 extensions::ManifestHandler::ClearRegistryForTesting(); | |
| 204 DevToolsSanityTest::CleanUpOnMainThread(); | |
| 205 } | |
| 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(); |
| 199 size_t num_before = service->extensions()->size(); | 211 size_t num_before = service->extensions()->size(); |
| 200 { | 212 { |
| 201 content::NotificationRegistrar registrar; | 213 content::NotificationRegistrar registrar; |
| 202 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 214 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 203 content::NotificationService::AllSources()); | 215 content::NotificationService::AllSources()); |
| 204 base::CancelableClosure timeout( | 216 base::CancelableClosure timeout( |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 devtools_http_handler_->Stop(); | 691 devtools_http_handler_->Stop(); |
| 680 return result; | 692 return result; |
| 681 } | 693 } |
| 682 }; | 694 }; |
| 683 | 695 |
| 684 IN_PROC_BROWSER_TEST_F(DISABLED_RemoteDebuggingTest, TargetList) { | 696 IN_PROC_BROWSER_TEST_F(DISABLED_RemoteDebuggingTest, TargetList) { |
| 685 ASSERT_TRUE(RunExtensionTest("target_list")); | 697 ASSERT_TRUE(RunExtensionTest("target_list")); |
| 686 } | 698 } |
| 687 | 699 |
| 688 } // namespace | 700 } // namespace |
| OLD | NEW |