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

Unified Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 11776010: overscroll: Take a screenshot at more appropriate times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_view_aura_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index 7d73c888a099b2e003a8a6edad85bef665a0243e..3a9d531c55803ca54f945668f9505386bdcd01e2 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -278,6 +278,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
// - interactively, when user does an overscroll gesture
// - interactively, when user navigates in history without the overscroll
// gesture.
+// - interactively, by the user navigating to a new page from the UI (e.g.
+// entering a URL in the omnibox, or navigating to a bookmark)
IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
OverscrollScreenshot) {
ASSERT_NO_FATAL_FAILURE(
@@ -361,6 +363,54 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
web_contents->GetController().GetEntryAtIndex(4));
EXPECT_TRUE(entry->screenshot().get());
}
+
+ for (int index = 6; index <= 7; ++index) {
+ // Navigate via the user initiating a navigation from the UI.
+ string16 expected_title =
+ ASCIIToUTF16(base::StringPrintf("Title: #%d", index));
+ content::TitleWatcher title_watcher(web_contents, expected_title);
+
+ GURL url(test_server()->GetURL(
+ base::StringPrintf("files/overscroll_navigation.html#%d", index)));
Charlie Reis 2013/01/09 00:49:23 Just curious-- these tests don't appear to be doin
sadrul 2013/01/09 17:44:19 Great catch! You are right. These do not fail with
+ NavigationController::LoadURLParams params(url);
+ params.transition_type = PageTransitionFromInt(
+ PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR);
+ web_contents->GetController().LoadURLWithParams(params);
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+ EXPECT_EQ(index, GetCurrentIndex());
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ web_contents->GetController().GetEntryAtOffset(-1));
+ EXPECT_TRUE(entry->screenshot().get());
+
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ web_contents->GetController().GetActiveEntry());
+ EXPECT_FALSE(entry->screenshot().get());
+ }
+
+ for (int index = 8; index <= 9; ++index) {
+ // Navigate to a bookmark from the UI.
+ string16 expected_title =
+ ASCIIToUTF16(base::StringPrintf("Title: #%d", index));
+ content::TitleWatcher title_watcher(web_contents, expected_title);
+
+ GURL url(test_server()->GetURL(
+ base::StringPrintf("files/overscroll_navigation.html#%d", index)));
+ NavigationController::LoadURLParams params(url);
+ params.transition_type = PageTransitionFromInt(
+ PAGE_TRANSITION_AUTO_BOOKMARK);
+ web_contents->GetController().LoadURLWithParams(params);
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+ EXPECT_EQ(index, GetCurrentIndex());
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ web_contents->GetController().GetEntryAtOffset(-1));
+ EXPECT_TRUE(entry->screenshot().get());
+
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ web_contents->GetController().GetActiveEntry());
+ EXPECT_FALSE(entry->screenshot().get());
+ }
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698