Chromium Code Reviews| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 GURL(), // source_main_frame_url | 288 GURL(), // source_main_frame_url |
| 289 download_url, // original_request_url | 289 download_url, // original_request_url |
| 290 download_url, // destination_url | 290 download_url, // destination_url |
| 291 false, // is_user_initiated, | 291 false, // is_user_initiated, |
| 292 false, // has_committed | 292 false, // has_committed |
| 293 false, // has_server_redirect | 293 false, // has_server_redirect |
| 294 nav_map->at(download_url).at(1)); | 294 nav_map->at(download_url).at(1)); |
| 295 VerifyHostToIpMap(); | 295 VerifyHostToIpMap(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 // https://crbug.com/667784: The test is flaky on Linux. | |
| 299 #if defined(OS_LINUX) | |
| 300 #define MAYBE_SingleMetaRefreshRedirect DISABLED_SingleMetaRefreshRedirect | |
| 301 #else | |
| 302 #define MAYBE_SingleMetaRefreshRedirect SingleMetaRefreshRedirect | |
| 303 #endif | |
| 298 // Click on a link which navigates to a page then redirects to a download using | 304 // Click on a link which navigates to a page then redirects to a download using |
| 299 // META HTTP-EQUIV="refresh". All transitions happen in the same tab. | 305 // META HTTP-EQUIV="refresh". All transitions happen in the same tab. |
| 300 IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, | 306 IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, |
| 301 SingleMetaRefreshRedirect) { | 307 MAYBE_SingleMetaRefreshRedirect) { |
| 302 ClickTestLink("single_meta_refresh_redirect", 2); | 308 ClickTestLink("single_meta_refresh_redirect", 2); |
| 303 GURL initial_url = embedded_test_server()->GetURL(kSingleFrameTestURL); | 309 GURL initial_url = embedded_test_server()->GetURL(kSingleFrameTestURL); |
| 304 GURL redirect_url = embedded_test_server()->GetURL(kRedirectURL); | 310 GURL redirect_url = embedded_test_server()->GetURL(kRedirectURL); |
| 305 GURL download_url = embedded_test_server()->GetURL(kDownloadItemURL); | 311 GURL download_url = embedded_test_server()->GetURL(kDownloadItemURL); |
| 306 auto nav_map = navigation_map(); | 312 auto nav_map = navigation_map(); |
| 307 ASSERT_TRUE(nav_map); | 313 ASSERT_TRUE(nav_map); |
| 308 // Since unlike server redirects client redirects commit and then generate a | 314 // Since unlike server redirects client redirects commit and then generate a |
| 309 // second navigation, our observer records two NavigationEvents for this test. | 315 // second navigation, our observer records two NavigationEvents for this test. |
| 310 ASSERT_EQ(std::size_t(2), nav_map->size()); | 316 ASSERT_EQ(std::size_t(2), nav_map->size()); |
| 311 ASSERT_EQ(std::size_t(1), nav_map->at(redirect_url).size()); | 317 ASSERT_EQ(std::size_t(1), nav_map->at(redirect_url).size()); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 325 false, // is_user_initiated, | 331 false, // is_user_initiated, |
| 326 false, // has_committed | 332 false, // has_committed |
| 327 false, // has_server_redirect | 333 false, // has_server_redirect |
| 328 nav_map->at(download_url).at(0)); | 334 nav_map->at(download_url).at(0)); |
| 329 VerifyHostToIpMap(); | 335 VerifyHostToIpMap(); |
| 330 } | 336 } |
| 331 | 337 |
| 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 SingleMetaRefreshRedirectTargetBlank) { |
|
Jialiu Lin
2016/11/23 21:33:58
I think this is the test you suppose to disable.
Łukasz Anforowicz
2016/11/23 21:43:44
Done.
| |
| 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 |