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

Unified Diff: chrome/browser/instant/instant_extended_browsertest.cc

Issue 12387089: Instant: Rename 'preview' to 'overlay' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_extended_browsertest.cc
diff --git a/chrome/browser/instant/instant_extended_browsertest.cc b/chrome/browser/instant/instant_extended_browsertest.cc
index 2e589c95d2037be49e4b6b5366670d3a8e0bebd9..f7dc747cbb8f8302e2d30fc4d7f5771c65f79ebc 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -107,9 +107,9 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxFocusLoadsInstant) {
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
EXPECT_FALSE(omnibox()->model()->has_focus());
- // Delete any existing preview.
+ // Delete any existing overlay.
instant()->overlay_.reset();
- EXPECT_FALSE(instant()->GetPreviewContents());
+ EXPECT_FALSE(instant()->GetOverlayContents());
// Refocus the omnibox. The InstantController should've preloaded Instant.
FocusOmniboxAndWaitForInstantSupport();
@@ -117,26 +117,26 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxFocusLoadsInstant) {
EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
EXPECT_TRUE(omnibox()->model()->has_focus());
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(preview_tab);
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(overlay);
// Check that the page supports Instant, but it isn't showing.
EXPECT_TRUE(instant()->overlay_->supports_instant());
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
EXPECT_TRUE(instant()->model()->mode().is_default());
- // Adding a new tab shouldn't delete or recreate the preview; otherwise,
+ // Adding a new tab shouldn't delete or recreate the overlay; otherwise,
// what's the point of preloading?
AddBlankTabAndShow(browser());
- EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
+ EXPECT_EQ(overlay, instant()->GetOverlayContents());
- // Unfocusing and refocusing the omnibox should also preserve the preview.
+ // Unfocusing and refocusing the omnibox should also preserve the overlay.
ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
FocusOmnibox();
EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
- EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
+ EXPECT_EQ(overlay, instant()->GetOverlayContents());
}
IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputShowsOverlay) {
@@ -144,15 +144,15 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputShowsOverlay) {
// Focus omnibox and confirm overlay isn't shown.
FocusOmniboxAndWaitForInstantSupport();
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(preview_tab);
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(overlay);
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
EXPECT_TRUE(instant()->model()->mode().is_default());
// Typing in the omnibox should show the overlay.
- SetOmniboxTextAndWaitForInstantToShow("query");
+ SetOmniboxTextAndWaitForOverlayToShow("query");
EXPECT_TRUE(instant()->model()->mode().is_search_suggestions());
- EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
+ EXPECT_EQ(overlay, instant()->GetOverlayContents());
}
// Test that middle clicking on a suggestion opens the result in a new tab.
@@ -165,8 +165,8 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
EXPECT_EQ(1, browser()->tab_strip_model()->count());
// Typing in the omnibox should show the overlay.
- SetOmniboxTextAndWaitForInstantToShow("santa");
- EXPECT_TRUE(instant()->IsPreviewingSearchResults());
+ SetOmniboxTextAndWaitForOverlayToShow("santa");
+ EXPECT_TRUE(instant()->IsOverlayingSearchResults());
// Create an event listener that opens the top suggestion in a new tab.
EXPECT_TRUE(ExecuteScript(
@@ -205,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
EXPECT_TRUE(ExecuteScript("suggestion = 'santa claus';"));
// Set the text, and wait for suggestions to show up.
- SetOmniboxTextAndWaitForInstantToShow("santa");
+ SetOmniboxTextAndWaitForOverlayToShow("santa");
EXPECT_EQ(ASCIIToUTF16("santa"), omnibox()->GetText());
// Test that the current suggestion is correctly set.
@@ -231,7 +231,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
EXPECT_TRUE(ExecuteScript("suggestion = 'johnny depp';"));
// Set the text, and wait for suggestions to show up.
- SetOmniboxTextAndWaitForInstantToShow("johnny");
+ SetOmniboxTextAndWaitForOverlayToShow("johnny");
EXPECT_EQ(ASCIIToUTF16("johnny"), omnibox()->GetText());
// Test that the current suggestion is correctly set.
@@ -255,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
FocusOmniboxAndWaitForInstantSupport();
// Do a search and commit it.
- SetOmniboxTextAndWaitForInstantToShow("hello k");
+ SetOmniboxTextAndWaitForOverlayToShow("hello k");
EXPECT_EQ(ASCIIToUTF16("hello k"), omnibox()->GetText());
browser()->window()->GetLocationBar()->AcceptInput();
@@ -282,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsWithArrowKeys) {
ASSERT_NO_FATAL_FAILURE(SetupInstant());
FocusOmniboxAndWaitForInstantSupport();
- SetOmniboxTextAndWaitForInstantToShow("hello");
+ SetOmniboxTextAndWaitForOverlayToShow("hello");
EXPECT_EQ("hello", GetOmniboxText());
SendDownArrow();
@@ -296,7 +296,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsWithArrowKeys) {
// Ensure that the API's value is set correctly.
std::string result;
- EXPECT_TRUE(GetStringFromJS(instant()->GetPreviewContents(),
+ EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(),
"window.chrome.searchBox.value",
&result));
EXPECT_EQ("hello", result);
@@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsAndHitEscape) {
ASSERT_NO_FATAL_FAILURE(SetupInstant());
FocusOmniboxAndWaitForInstantSupport();
- SetOmniboxTextAndWaitForInstantToShow("hello");
+ SetOmniboxTextAndWaitForOverlayToShow("hello");
EXPECT_EQ("hello", GetOmniboxText());
SendDownArrow();
@@ -332,7 +332,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsAndHitEscape) {
// Ensure that the API's value is set correctly.
std::string result;
- EXPECT_TRUE(GetStringFromJS(instant()->GetPreviewContents(),
+ EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(),
"window.chrome.searchBox.value",
&result));
EXPECT_EQ("hello", result);
@@ -468,9 +468,9 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputOnNTPDoesntShowOverlay) {
// Focus omnibox and confirm overlay isn't shown.
FocusOmniboxAndWaitForInstantSupport();
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(preview_tab);
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(overlay);
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
EXPECT_TRUE(instant()->model()->mode().is_default());
// Navigate to the NTP.
@@ -482,7 +482,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputOnNTPDoesntShowOverlay) {
// Typing in the omnibox should not show the overlay.
SetOmniboxText("query");
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
EXPECT_TRUE(instant()->model()->mode().is_default());
}
@@ -504,9 +504,9 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ProcessIsolation) {
EXPECT_EQ(1, instant_service->GetInstantProcessCount());
// And the Instant overlay and ntp should live inside it.
- content::WebContents* preview = instant()->GetPreviewContents();
+ content::WebContents* overlay = instant()->GetOverlayContents();
EXPECT_TRUE(instant_service->IsInstantProcess(
- preview->GetRenderProcessHost()->GetID()));
+ overlay->GetRenderProcessHost()->GetID()));
content::WebContents* ntp_contents = instant()->ntp_->contents();
EXPECT_TRUE(instant_service->IsInstantProcess(
ntp_contents->GetRenderProcessHost()->GetID()));
@@ -537,34 +537,34 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DISABLED_UnrelatedSiteInstance) {
ASSERT_NO_FATAL_FAILURE(SetupInstant());
FocusOmniboxAndWaitForInstantSupport();
- // Check that the uncommited ntp page and uncommited preview have unrelated
+ // Check that the uncommited ntp page and uncommited overlay have unrelated
// site instances.
// TODO(sreeram): |ntp_| is going away, so this check can be removed in the
// future.
- content::WebContents* preview = instant()->GetPreviewContents();
+ content::WebContents* overlay = instant()->GetOverlayContents();
content::WebContents* ntp_contents = instant()->ntp_->contents();
- EXPECT_FALSE(preview->GetSiteInstance()->IsRelatedSiteInstance(
+ EXPECT_FALSE(overlay->GetSiteInstance()->IsRelatedSiteInstance(
ntp_contents->GetSiteInstance()));
- // Type a query and hit enter to get a results page. The preview becomes the
+ // Type a query and hit enter to get a results page. The overlay becomes the
// active tab.
- SetOmniboxTextAndWaitForInstantToShow("hello");
+ SetOmniboxTextAndWaitForOverlayToShow("hello");
EXPECT_EQ("hello", GetOmniboxText());
browser()->window()->GetLocationBar()->AcceptInput();
content::WebContents* first_active_tab =
browser()->tab_strip_model()->GetActiveWebContents();
- EXPECT_EQ(first_active_tab, preview);
+ EXPECT_EQ(first_active_tab, overlay);
scoped_refptr<content::SiteInstance> first_site_instance =
first_active_tab->GetSiteInstance();
EXPECT_FALSE(first_site_instance->IsRelatedSiteInstance(
ntp_contents->GetSiteInstance()));
// Navigating elsewhere gets us off of the commited page. The next
- // query will give us a new |preview| which we will then commit.
+ // query will give us a new |overlay| which we will then commit.
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIAboutURL));
- // Show and commit the new preview.
- SetOmniboxTextAndWaitForInstantToShow("hello again");
+ // Show and commit the new overlay.
+ SetOmniboxTextAndWaitForOverlayToShow("hello again");
EXPECT_EQ("hello again", GetOmniboxText());
browser()->window()->GetLocationBar()->AcceptInput();
content::WebContents* second_active_tab =
@@ -585,7 +585,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ValidatesSuggestions) {
// Do not set gray text that is not a suffix of the query.
EXPECT_TRUE(ExecuteScript("behavior = 2"));
EXPECT_TRUE(ExecuteScript("suggestion = 'potato'"));
- SetOmniboxTextAndWaitForInstantToShow("query");
+ SetOmniboxTextAndWaitForOverlayToShow("query");
EXPECT_EQ(ASCIIToUTF16("query"), omnibox()->GetText());
EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion());
@@ -594,7 +594,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ValidatesSuggestions) {
// Do not set blue text that is not a valid URL completion.
EXPECT_TRUE(ExecuteScript("behavior = 1"));
EXPECT_TRUE(ExecuteScript("suggestion = 'this is not a url!'"));
- SetOmniboxTextAndWaitForInstantToShow("this is");
+ SetOmniboxTextAndWaitForOverlayToShow("this is");
EXPECT_EQ(ASCIIToUTF16("this is"), omnibox()->GetText());
EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion());
@@ -604,7 +604,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ValidatesSuggestions) {
// First set up some blue text completion.
EXPECT_TRUE(ExecuteScript("behavior = 1"));
EXPECT_TRUE(ExecuteScript("suggestion = 'www.example.com'"));
- SetOmniboxTextAndWaitForInstantToShow("http://www.ex");
+ SetOmniboxTextAndWaitForOverlayToShow("http://www.ex");
string16 text = omnibox()->GetText();
EXPECT_EQ(ASCIIToUTF16("http://www.example.com"), text);
size_t start = 0, end = 0;
@@ -642,14 +642,14 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
// Get a handle to the NTP and the current state of the JS.
ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
- content::WebContents* preview_tab = instant()->ntp_->contents();
- EXPECT_TRUE(preview_tab);
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ content::WebContents* overlay = instant()->ntp_->contents();
+ EXPECT_TRUE(overlay);
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Wait for most visited data to be ready, if necessary.
if (on_most_visited_change_calls_ == 0) {
observer.Wait();
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
}
EXPECT_EQ(1, on_most_visited_change_calls_);
@@ -669,7 +669,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
observer.Wait();
// Update Most Visited state.
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Make sure we have one less item in there.
EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count - 1);
@@ -681,7 +681,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
observer.Wait();
// Update Most Visited state.
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Make sure we have the same number of items as before.
EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count);
@@ -694,7 +694,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
observer.Wait();
// Update Most Visited state.
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Delete the second Most Visited Item.
rid = first_most_visited_item_id_;
@@ -704,7 +704,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
observer.Wait();
// Update Most Visited state.
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Make sure we have two less items in there.
EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count - 2);
@@ -716,7 +716,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
observer.Wait();
// Update Most Visited state.
- EXPECT_TRUE(UpdateSearchState(preview_tab));
+ EXPECT_TRUE(UpdateSearchState(overlay));
// Make sure we have the same number of items as before.
EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count);
@@ -736,10 +736,10 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_HomeButtonAffectsMargin) {
// Get the current value of the start-edge margin and width.
int start_margin;
int width;
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(GetIntFromJS(overlay, "chrome.searchBox.startMargin",
&start_margin));
- EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &width));
+ EXPECT_TRUE(GetIntFromJS(overlay, "chrome.searchBox.width", &width));
// Toggle the home button visibility pref.
PrefService* profile_prefs = browser()->profile()->GetPrefs();
@@ -749,9 +749,9 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_HomeButtonAffectsMargin) {
// Make sure the margin and width changed.
int new_start_margin;
int new_width;
- EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ EXPECT_TRUE(GetIntFromJS(overlay, "chrome.searchBox.startMargin",
&new_start_margin));
- EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &new_width));
+ EXPECT_TRUE(GetIntFromJS(overlay, "chrome.searchBox.width", &new_width));
EXPECT_NE(start_margin, new_start_margin);
EXPECT_NE(width, new_width);
EXPECT_EQ(new_width - width, start_margin - new_start_margin);
@@ -764,7 +764,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_HomeButtonAffectsMargin) {
#else
#define MAYBE_CommitWhenFocusLostInFullHeight CommitWhenFocusLostInFullHeight
#endif
-// Test that the preview is committed when the omnibox loses focus when it is
+// Test that the overlay is committed when the omnibox loses focus when it is
// shown at 100% height.
IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
MAYBE_CommitWhenFocusLostInFullHeight) {
@@ -772,15 +772,15 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
// Focus omnibox and confirm overlay isn't shown.
FocusOmniboxAndWaitForInstantSupport();
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(preview_tab);
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(overlay);
EXPECT_TRUE(instant()->model()->mode().is_default());
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
// Typing in the omnibox should show the overlay.
- SetOmniboxTextAndWaitForInstantToShow("query");
- EXPECT_TRUE(instant()->IsPreviewingSearchResults());
- EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
+ SetOmniboxTextAndWaitForOverlayToShow("query");
+ EXPECT_TRUE(instant()->IsOverlayingSearchResults());
+ EXPECT_EQ(overlay, instant()->GetOverlayContents());
// Explicitly unfocus the omnibox without triggering a click. Note that this
// doesn't actually change the focus state of the omnibox, only what the
@@ -791,10 +791,10 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
// Confirm that the overlay has been committed.
content::WebContents* active_tab =
browser()->tab_strip_model()->GetActiveWebContents();
- EXPECT_EQ(preview_tab, active_tab);
+ EXPECT_EQ(overlay, active_tab);
}
-// Test that the preview is committed when shown at 100% height without focus
+// Test that the overlay is committed when shown at 100% height without focus
// in the omnibox.
IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
CommitWhenShownInFullHeightWithoutFocus) {
@@ -802,10 +802,10 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
// Focus omnibox and confirm overlay isn't shown.
FocusOmniboxAndWaitForInstantSupport();
- content::WebContents* preview_tab = instant()->GetPreviewContents();
- EXPECT_TRUE(preview_tab);
+ content::WebContents* overlay = instant()->GetOverlayContents();
+ EXPECT_TRUE(overlay);
EXPECT_TRUE(instant()->model()->mode().is_default());
- EXPECT_FALSE(instant()->IsPreviewingSearchResults());
+ EXPECT_FALSE(instant()->IsOverlayingSearchResults());
// Create an observer to wait for the commit.
content::WindowedNotificationObserver observer(
@@ -828,5 +828,5 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
// Confirm that the overlay has been committed.
content::WebContents* active_tab =
browser()->tab_strip_model()->GetActiveWebContents();
- EXPECT_EQ(preview_tab, active_tab);
+ EXPECT_EQ(overlay, active_tab);
}
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698