| 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" | 9 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager
.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 redirect_url, // source_main_frame_url | 322 redirect_url, // source_main_frame_url |
| 323 download_url, // original_request_url | 323 download_url, // original_request_url |
| 324 download_url, // destination_url | 324 download_url, // destination_url |
| 325 false, // is_user_initiated, | 325 false, // is_user_initiated, |
| 326 false, // has_committed | 326 false, // has_committed |
| 327 false, // has_server_redirect | 327 false, // has_server_redirect |
| 328 nav_map->at(download_url).at(0)); | 328 nav_map->at(download_url).at(0)); |
| 329 VerifyHostToIpMap(); | 329 VerifyHostToIpMap(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // https://crbug.com/667784: The test is flaky on Linux. |
| 333 #if defined(OS_LINUX) |
| 334 #define MAYBE_SingleMetaRefreshRedirectTargetBlank DISABLED_SingleMetaRefreshRed
irectTargetBlank |
| 335 #else |
| 336 #define MAYBE_SingleMetaRefreshRedirectTargetBlank SingleMetaRefreshRedirectTarg
etBlank |
| 337 #endif |
| 332 // Click on a link which navigates to a page then redirects to a download using | 338 // Click on a link which navigates to a page then redirects to a download using |
| 333 // META HTTP-EQUIV="refresh". First navigation happens in target blank. | 339 // META HTTP-EQUIV="refresh". First navigation happens in target blank. |
| 334 IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, | 340 IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, |
| 335 SingleMetaRefreshRedirectTargetBlank) { | 341 MAYBE_SingleMetaRefreshRedirectTargetBlank) { |
| 336 ClickTestLink("single_meta_refresh_redirect_target_blank", 2); | 342 ClickTestLink("single_meta_refresh_redirect_target_blank", 2); |
| 337 GURL initial_url = embedded_test_server()->GetURL(kSingleFrameTestURL); | 343 GURL initial_url = embedded_test_server()->GetURL(kSingleFrameTestURL); |
| 338 GURL redirect_url = embedded_test_server()->GetURL(kRedirectURL); | 344 GURL redirect_url = embedded_test_server()->GetURL(kRedirectURL); |
| 339 GURL download_url = embedded_test_server()->GetURL(kDownloadItemURL); | 345 GURL download_url = embedded_test_server()->GetURL(kDownloadItemURL); |
| 340 auto nav_map = navigation_map(); | 346 auto nav_map = navigation_map(); |
| 341 ASSERT_TRUE(nav_map); | 347 ASSERT_TRUE(nav_map); |
| 342 ASSERT_EQ(std::size_t(2), nav_map->size()); | 348 ASSERT_EQ(std::size_t(2), nav_map->size()); |
| 343 ASSERT_EQ(std::size_t(2), nav_map->at(redirect_url).size()); | 349 ASSERT_EQ(std::size_t(2), nav_map->at(redirect_url).size()); |
| 344 ASSERT_EQ(std::size_t(1), nav_map->at(download_url).size()); | 350 ASSERT_EQ(std::size_t(1), nav_map->at(download_url).size()); |
| 345 // TODO(jialiul): After https://crbug.com/651895 is fixed, we'll no longer | 351 // TODO(jialiul): After https://crbug.com/651895 is fixed, we'll no longer |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 yesterday, embedded_test_server()->host_port_pair().host())); | 774 yesterday, embedded_test_server()->host_port_pair().host())); |
| 769 ASSERT_EQ(std::size_t(1), ip_map->at(test_server_host).size()); | 775 ASSERT_EQ(std::size_t(1), ip_map->at(test_server_host).size()); |
| 770 ClickTestLink("direct_download", 1); | 776 ClickTestLink("direct_download", 1); |
| 771 EXPECT_EQ(std::size_t(1), ip_map->at(test_server_host).size()); | 777 EXPECT_EQ(std::size_t(1), ip_map->at(test_server_host).size()); |
| 772 EXPECT_EQ(embedded_test_server()->host_port_pair().host(), | 778 EXPECT_EQ(embedded_test_server()->host_port_pair().host(), |
| 773 ip_map->at(test_server_host).back().ip); | 779 ip_map->at(test_server_host).back().ip); |
| 774 EXPECT_NE(yesterday, ip_map->at(test_server_host).front().timestamp); | 780 EXPECT_NE(yesterday, ip_map->at(test_server_host).front().timestamp); |
| 775 } | 781 } |
| 776 | 782 |
| 777 } // namespace safe_browsing | 783 } // namespace safe_browsing |
| OLD | NEW |