Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc

Issue 2764943003: Attempt to de-flake popup blocker test for PlzNavigate (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 switches::kDisablePopupBlocking); 339 switches::kDisablePopupBlocking);
340 GURL url( 340 GURL url(
341 embedded_test_server()->GetURL("/popup_blocker/popup-on-unload.html")); 341 embedded_test_server()->GetURL("/popup_blocker/popup-on-unload.html"));
342 ui_test_utils::NavigateToURL(browser(), url); 342 ui_test_utils::NavigateToURL(browser(), url);
343 343
344 NavigateAndCheckPopupShown(embedded_test_server()->GetURL("/popup_blocker/"), 344 NavigateAndCheckPopupShown(embedded_test_server()->GetURL("/popup_blocker/"),
345 ExpectPopup); 345 ExpectPopup);
346 } 346 }
347 347
348 // Verify that when you unblock popup, the popup shows in history and omnibox. 348 // Verify that when you unblock popup, the popup shows in history and omnibox.
349 // TODO(crbug.com/663333) Flaky on Linux.
350 #if defined(OS_LINUX)
351 #define MAYBE_UnblockedPopupShowsInHistoryAndOmnibox \
352 DISABLED_UnblockedPopupShowsInHistoryAndOmnibox
353 #else
354 #define MAYBE_UnblockedPopupShowsInHistoryAndOmnibox \
355 UnblockedPopupShowsInHistoryAndOmnibox
356 #endif
357 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, 349 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest,
358 MAYBE_UnblockedPopupShowsInHistoryAndOmnibox) { 350 UnblockedPopupShowsInHistoryAndOmnibox) {
359 base::CommandLine::ForCurrentProcess()->AppendSwitch( 351 base::CommandLine::ForCurrentProcess()->AppendSwitch(
360 switches::kDisablePopupBlocking); 352 switches::kDisablePopupBlocking);
361 GURL url(embedded_test_server()->GetURL( 353 GURL url(embedded_test_server()->GetURL(
362 "/popup_blocker/popup-blocked-to-post-blank.html")); 354 "/popup_blocker/popup-blocked-to-post-blank.html"));
363 NavigateAndCheckPopupShown(url, ExpectTab); 355 NavigateAndCheckPopupShown(url, ExpectTab);
364 356
357 // Make sure the navigation in the new tab actually finished.
358 WebContents* web_contents = browser()->tab_strip_model()->GetWebContentsAt(1);
359 base::string16 expected_title(base::ASCIIToUTF16("Popup Success!"));
360 content::TitleWatcher title_watcher(web_contents, expected_title);
361 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
362 WaitForHistoryBackendToRun(browser()->profile());
363
365 std::string search_string = 364 std::string search_string =
366 "data:text/html,<title>Popup Success!</title>you should not see this " 365 "data:text/html,<title>Popup Success!</title>you should not see this "
367 "message if popup blocker is enabled"; 366 "message if popup blocker is enabled";
368 367
369 WaitForHistoryBackendToRun(browser()->profile());
370 ui_test_utils::HistoryEnumerator history(browser()->profile()); 368 ui_test_utils::HistoryEnumerator history(browser()->profile());
371 std::vector<GURL>& history_urls = history.urls(); 369 std::vector<GURL>& history_urls = history.urls();
372 ASSERT_EQ(2u, history_urls.size()); 370 ASSERT_EQ(2u, history_urls.size());
373 ASSERT_EQ(GURL(search_string), history_urls[0]); 371 ASSERT_EQ(GURL(search_string), history_urls[0]);
374 ASSERT_EQ(url, history_urls[1]); 372 ASSERT_EQ(url, history_urls[1]);
375 373
376 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( 374 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile(
377 browser()->profile()); 375 browser()->profile());
378 search_test_utils::WaitForTemplateURLServiceToLoad(service); 376 search_test_utils::WaitForTemplateURLServiceToLoad(service);
379 LocationBar* location_bar = browser()->window()->GetLocationBar(); 377 LocationBar* location_bar = browser()->window()->GetLocationBar();
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 833
836 wait_for_new_tab.Wait(); 834 wait_for_new_tab.Wait();
837 835
838 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); 836 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
839 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 837 ASSERT_EQ(2, browser()->tab_strip_model()->count());
840 // Check that we create the background tab. 838 // Check that we create the background tab.
841 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 839 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
842 } 840 }
843 841
844 } // namespace 842 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698