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/devtools_window.h" | 14 #include "chrome/browser/devtools/devtools_window.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/unpacked_installer.h" | 17 #include "chrome/browser/extensions/unpacked_installer.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/url_constants.h" |
25 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
26 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
27 #include "content/public/browser/child_process_data.h" | 28 #include "content/public/browser/child_process_data.h" |
28 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/devtools_agent_host.h" | 30 #include "content/public/browser/devtools_agent_host.h" |
30 #include "content/public/browser/devtools_client_host.h" | 31 #include "content/public/browser/devtools_client_host.h" |
31 #include "content/public/browser/devtools_manager.h" | 32 #include "content/public/browser/devtools_manager.h" |
32 #include "content/public/browser/notification_registrar.h" | 33 #include "content/public/browser/notification_registrar.h" |
33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 // Tests raw headers text. | 498 // Tests raw headers text. |
498 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestNetworkRawHeadersText) { | 499 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestNetworkRawHeadersText) { |
499 RunTest("testNetworkRawHeadersText", kChunkedTestPage); | 500 RunTest("testNetworkRawHeadersText", kChunkedTestPage); |
500 } | 501 } |
501 | 502 |
502 // Tests that console messages are not duplicated on navigation back. | 503 // Tests that console messages are not duplicated on navigation back. |
503 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestConsoleOnNavigateBack) { | 504 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestConsoleOnNavigateBack) { |
504 RunTest("testConsoleOnNavigateBack", kNavigateBackTestPage); | 505 RunTest("testConsoleOnNavigateBack", kNavigateBackTestPage); |
505 } | 506 } |
506 | 507 |
| 508 |
| 509 // Tests that external navigation from inspector page is always handled by |
| 510 // DevToolsWindow and results in inspected page navigation. |
| 511 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsExternalNavigation) { |
| 512 OpenDevToolsWindow(kDebuggerTestPage); |
| 513 GURL url = test_server()->GetURL(kNavigateBackTestPage); |
| 514 content::WindowedNotificationObserver observer( |
| 515 content::NOTIFICATION_LOAD_STOP, |
| 516 content::NotificationService::AllSources()); |
| 517 ASSERT_TRUE(content::ExecuteScript( |
| 518 window_->web_contents(), |
| 519 std::string("window.location = \"") + url.spec() + "\"")); |
| 520 observer.Wait(); |
| 521 |
| 522 ASSERT_TRUE(window_->web_contents()->GetURL(). |
| 523 SchemeIs(chrome::kChromeDevToolsScheme)); |
| 524 ASSERT_EQ(GetInspectedTab()->GetURL(), url); |
| 525 } |
| 526 |
507 // Tests that inspector will reattach to inspected page when it is reloaded | 527 // Tests that inspector will reattach to inspected page when it is reloaded |
508 // after a crash. See http://crbug.com/101952 | 528 // after a crash. See http://crbug.com/101952 |
509 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { | 529 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { |
510 OpenDevToolsWindow(kDebuggerTestPage); | 530 OpenDevToolsWindow(kDebuggerTestPage); |
511 | 531 |
512 content::CrashTab(GetInspectedTab()); | 532 content::CrashTab(GetInspectedTab()); |
513 content::WindowedNotificationObserver observer( | 533 content::WindowedNotificationObserver observer( |
514 content::NOTIFICATION_LOAD_STOP, | 534 content::NOTIFICATION_LOAD_STOP, |
515 content::Source<NavigationController>( | 535 content::Source<NavigationController>( |
516 &browser()->tab_strip_model()->GetActiveWebContents()-> | 536 &browser()->tab_strip_model()->GetActiveWebContents()-> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 content::CONSOLE_MESSAGE_LEVEL_LOG, | 604 content::CONSOLE_MESSAGE_LEVEL_LOG, |
585 "log"); | 605 "log"); |
586 devtools_manager->AddMessageToConsole(agent_host, | 606 devtools_manager->AddMessageToConsole(agent_host, |
587 content::CONSOLE_MESSAGE_LEVEL_ERROR, | 607 content::CONSOLE_MESSAGE_LEVEL_ERROR, |
588 "error"); | 608 "error"); |
589 RunTestFunction(window_, "checkLogAndErrorMessages"); | 609 RunTestFunction(window_, "checkLogAndErrorMessages"); |
590 CloseDevToolsWindow(); | 610 CloseDevToolsWindow(); |
591 } | 611 } |
592 | 612 |
593 } // namespace | 613 } // namespace |
OLD | NEW |