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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 316403004: Test for the fix for history.replaceState navigations submitted earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also testing reloads. Created 6 years, 6 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 | content/test/data/overscroll_navigation.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // increased screenshot interval. 548 // increased screenshot interval.
549 NavigationController::LoadURLParams params(navigations[0].url); 549 NavigationController::LoadURLParams params(navigations[0].url);
550 params.transition_type = PageTransitionFromInt(navigations[0].transition); 550 params.transition_type = PageTransitionFromInt(navigations[0].transition);
551 web_contents->GetController().LoadURLWithParams(params); 551 web_contents->GetController().LoadURLWithParams(params);
552 WaitForLoadStop(web_contents); 552 WaitForLoadStop(web_contents);
553 screenshot_manager()->WaitUntilScreenshotIsReady(); 553 screenshot_manager()->WaitUntilScreenshotIsReady();
554 554
555 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for()); 555 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for());
556 } 556 }
557 557
558 // Tests that navigations resulting from reloads and history.replaceState
559 // do not capture screenshots.
560 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateAndReload) {
561 ASSERT_NO_FATAL_FAILURE(
562 StartTestWithPage("files/overscroll_navigation.html"));
563 WebContentsImpl* web_contents =
564 static_cast<WebContentsImpl*>(shell()->web_contents());
565 RenderFrameHost* main_frame = web_contents->GetMainFrame();
566
567 set_min_screenshot_interval(0);
568 screenshot_manager()->Reset();
569 ExecuteSyncJSFunction(main_frame, "use_replace_state()");
570 screenshot_manager()->WaitUntilScreenshotIsReady();
571 // history.replaceState shouldn't capture a screenshot
572 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for());
573 screenshot_manager()->Reset();
574 web_contents->GetController().Reload(true);
575 WaitForLoadStop(web_contents);
576 // reloading the page shouldn't capture a screenshot
577 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for());
nasko 2014/06/11 16:35:39 nit: for completeness, I'd add a real navigation o
mfomitchev 2014/06/11 17:22:07 Done.
578 }
579
558 // TODO(sadrul): This test is disabled because it reparents in a way the 580 // TODO(sadrul): This test is disabled because it reparents in a way the
559 // FocusController does not support. This code would crash in 581 // FocusController does not support. This code would crash in
560 // a production build. It only passed prior to this revision 582 // a production build. It only passed prior to this revision
561 // because testing used the old FocusManager which did some 583 // because testing used the old FocusManager which did some
562 // different (osbolete) processing. TODO(sadrul) to figure out 584 // different (osbolete) processing. TODO(sadrul) to figure out
563 // how this test should work that mimics production code a bit 585 // how this test should work that mimics production code a bit
564 // better. 586 // better.
565 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, 587 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
566 DISABLED_ContentWindowReparent) { 588 DISABLED_ContentWindowReparent) {
567 ASSERT_NO_FATAL_FAILURE( 589 ASSERT_NO_FATAL_FAILURE(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 static_cast<WebContentsImpl*>(shell()->web_contents()); 703 static_cast<WebContentsImpl*>(shell()->web_contents());
682 aura::Window* content = web_contents->GetNativeView()->parent(); 704 aura::Window* content = web_contents->GetNativeView()->parent();
683 EXPECT_TRUE(web_contents->should_normally_be_visible()); 705 EXPECT_TRUE(web_contents->should_normally_be_visible());
684 content->Hide(); 706 content->Hide();
685 EXPECT_FALSE(web_contents->should_normally_be_visible()); 707 EXPECT_FALSE(web_contents->should_normally_be_visible());
686 content->Show(); 708 content->Show();
687 EXPECT_TRUE(web_contents->should_normally_be_visible()); 709 EXPECT_TRUE(web_contents->should_normally_be_visible());
688 } 710 }
689 711
690 } // namespace content 712 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/overscroll_navigation.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698