| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 8 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "components/url_formatter/url_formatter.h" | 14 #include "components/url_formatter/url_formatter.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 15 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/browser/navigation_handle.h" | 16 #include "content/public/browser/navigation_handle.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "content/public/common/content_switches.h" |
| 20 #include "content/public/common/context_menu_params.h" | 21 #include "content/public/common/context_menu_params.h" |
| 21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
| 23 #include "content/public/test/test_navigation_observer.h" | 24 #include "content/public/test/test_navigation_observer.h" |
| 24 #include "net/dns/mock_host_resolver.h" | 25 #include "net/dns/mock_host_resolver.h" |
| 25 | 26 |
| 26 class ChromeNavigationBrowserTest : public InProcessBrowserTest { | 27 class ChromeNavigationBrowserTest : public InProcessBrowserTest { |
| 27 public: | 28 public: |
| 28 ChromeNavigationBrowserTest() {} | 29 ChromeNavigationBrowserTest() {} |
| 29 ~ChromeNavigationBrowserTest() override {} | 30 ~ChromeNavigationBrowserTest() override {} |
| 30 | 31 |
| 31 void SetUpCommandLine(base::CommandLine* command_line) override { | 32 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 33 // Backgrounded renderer processes run at a lower priority, causing the |
| 34 // tests to take more time to complete. Disable backgrounding so that the |
| 35 // tests don't time out. |
| 36 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); |
| 37 |
| 32 ASSERT_TRUE(embedded_test_server()->Start()); | 38 ASSERT_TRUE(embedded_test_server()->Start()); |
| 33 } | 39 } |
| 34 | 40 |
| 35 void StartServerWithExpiredCert() { | 41 void StartServerWithExpiredCert() { |
| 36 expired_https_server_.reset( | 42 expired_https_server_.reset( |
| 37 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); | 43 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); |
| 38 expired_https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED); | 44 expired_https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED); |
| 39 expired_https_server_->AddDefaultHandlers( | 45 expired_https_server_->AddDefaultHandlers( |
| 40 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 46 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 41 ASSERT_TRUE(expired_https_server_->Start()); | 47 ASSERT_TRUE(expired_https_server_->Start()); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 browser()->tab_strip_model()->GetWebContentsAt( | 250 browser()->tab_strip_model()->GetWebContentsAt( |
| 245 browser()->tab_strip_model()->count() - 1); | 251 browser()->tab_strip_model()->count() - 1); |
| 246 WaitForLoadStop(new_web_contents); | 252 WaitForLoadStop(new_web_contents); |
| 247 | 253 |
| 248 // If the test is unsuccessful, the return value from GetLastCommittedURL | 254 // If the test is unsuccessful, the return value from GetLastCommittedURL |
| 249 // will be the virtual URL for the created NavigationEntry. | 255 // will be the virtual URL for the created NavigationEntry. |
| 250 // Note: Before the bug was fixed, the URL was the new_tab_url with a scheme | 256 // Note: Before the bug was fixed, the URL was the new_tab_url with a scheme |
| 251 // prepended and one less ":" character after the host. | 257 // prepended and one less ":" character after the host. |
| 252 EXPECT_EQ(GURL(), new_web_contents->GetLastCommittedURL()); | 258 EXPECT_EQ(GURL(), new_web_contents->GetLastCommittedURL()); |
| 253 } | 259 } |
| OLD | NEW |