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/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" | 16 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" |
17 #include "chrome/browser/devtools/devtools_window_testing.h" | 17 #include "chrome/browser/devtools/devtools_window_testing.h" |
18 #include "chrome/browser/extensions/extension_apitest.h" | 18 #include "chrome/browser/extensions/extension_apitest.h" |
19 #include "chrome/browser/extensions/extension_browsertest.h" | 19 #include "chrome/browser/extensions/extension_browsertest.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/extensions/unpacked_installer.h" | 21 #include "chrome/browser/extensions/unpacked_installer.h" |
22 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands.h" |
26 #include "chrome/browser/ui/browser_iterator.h" | 26 #include "chrome/browser/ui/browser_iterator.h" |
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/pref_names.h" | |
30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
31 #include "chrome/test/base/in_process_browser_test.h" | 32 #include "chrome/test/base/in_process_browser_test.h" |
32 #include "chrome/test/base/test_switches.h" | 33 #include "chrome/test/base/test_switches.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
34 #include "components/app_modal/javascript_app_modal_dialog.h" | 35 #include "components/app_modal/javascript_app_modal_dialog.h" |
35 #include "components/app_modal/native_app_modal_dialog.h" | 36 #include "components/app_modal/native_app_modal_dialog.h" |
36 #include "content/public/browser/child_process_data.h" | 37 #include "content/public/browser/child_process_data.h" |
37 #include "content/public/browser/content_browser_client.h" | 38 #include "content/public/browser/content_browser_client.h" |
38 #include "content/public/browser/devtools_agent_host.h" | 39 #include "content/public/browser/devtools_agent_host.h" |
39 #include "content/public/browser/devtools_http_handler.h" | 40 #include "content/public/browser/devtools_http_handler.h" |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
805 #endif | 806 #endif |
806 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, MAYBE_TestConsoleOnNavigateBack) { | 807 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, MAYBE_TestConsoleOnNavigateBack) { |
807 RunTest("testConsoleOnNavigateBack", kNavigateBackTestPage); | 808 RunTest("testConsoleOnNavigateBack", kNavigateBackTestPage); |
808 } | 809 } |
809 | 810 |
810 // https://crbug.com/397889 | 811 // https://crbug.com/397889 |
811 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, DISABLED_TestDeviceEmulation) { | 812 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, DISABLED_TestDeviceEmulation) { |
812 RunTest("testDeviceMetricsOverrides", "about:blank"); | 813 RunTest("testDeviceMetricsOverrides", "about:blank"); |
813 } | 814 } |
814 | 815 |
815 | |
816 // Tests that external navigation from inspector page is always handled by | 816 // Tests that external navigation from inspector page is always handled by |
817 // DevToolsWindow and results in inspected page navigation. | 817 // DevToolsWindow and results in inspected page navigation. |
818 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { | 818 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { |
819 OpenDevToolsWindow(kDebuggerTestPage, true); | 819 OpenDevToolsWindow(kDebuggerTestPage, true); |
820 GURL url = test_server()->GetURL(kNavigateBackTestPage); | 820 GURL url = test_server()->GetURL(kNavigateBackTestPage); |
821 ui_test_utils::UrlLoadObserver observer(url, | 821 ui_test_utils::UrlLoadObserver observer(url, |
822 content::NotificationService::AllSources()); | 822 content::NotificationService::AllSources()); |
823 ASSERT_TRUE(content::ExecuteScript( | 823 ASSERT_TRUE(content::ExecuteScript( |
824 main_web_contents(), | 824 main_web_contents(), |
825 std::string("window.location = \"") + url.spec() + "\"")); | 825 std::string("window.location = \"") + url.spec() + "\"")); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
946 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, MAYBE_RemoteDebugger) { | 946 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, MAYBE_RemoteDebugger) { |
947 #if defined(OS_WIN) && defined(USE_ASH) | 947 #if defined(OS_WIN) && defined(USE_ASH) |
948 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 948 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
949 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 949 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
950 switches::kAshBrowserTests)) | 950 switches::kAshBrowserTests)) |
951 return; | 951 return; |
952 #endif | 952 #endif |
953 | 953 |
954 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; | 954 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; |
955 } | 955 } |
956 | |
957 typedef InProcessBrowserTest DevToolsPolicyTest; | |
dgozman
2015/03/11 10:32:31
typedef -> using
| |
958 IN_PROC_BROWSER_TEST_F(DevToolsPolicyTest, PolicyTrue) { | |
959 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDevToolsDisabled, | |
960 true); | |
dgozman
2015/03/11 10:32:31
nit: indentation
| |
961 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | |
962 content::WebContents* web_contents = | |
963 browser()->tab_strip_model()->GetWebContentsAt(0); | |
964 scoped_refptr<content::DevToolsAgentHost> agent( | |
965 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); | |
966 DevToolsWindow::OpenDevToolsWindow(web_contents); | |
967 DevToolsWindow* window_ = DevToolsWindow::FindDevToolsWindow(agent.get()); | |
968 ASSERT_FALSE(window_); | |
969 } | |
OLD | NEW |