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

Unified Diff: chrome/browser/ui/search/instant_test_utils.cc

Issue 18223002: InstantExtended: Remove overlay control code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call renamed method. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_test_utils.cc
diff --git a/chrome/browser/ui/search/instant_test_utils.cc b/chrome/browser/ui/search/instant_test_utils.cc
index e55c2e2b96a4d1b9b4fa030a11ebe6194106de1c..1ccbd03ea664dcd2913e13580548c48156394742 100644
--- a/chrome/browser/ui/search/instant_test_utils.cc
+++ b/chrome/browser/ui/search/instant_test_utils.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/search/instant_ntp.h"
-#include "chrome/browser/ui/search/instant_overlay.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -32,32 +31,6 @@ std::string WrapScript(const std::string& script) {
} // namespace
-// InstantTestModelObserver --------------------------------------------------
-
-InstantTestModelObserver::InstantTestModelObserver(
- InstantOverlayModel* model,
- SearchMode::Type expected_mode_type)
- : model_(model),
- expected_mode_type_(expected_mode_type),
- observed_mode_type_(static_cast<SearchMode::Type>(-1)) {
- model_->AddObserver(this);
-}
-
-InstantTestModelObserver::~InstantTestModelObserver() {
- model_->RemoveObserver(this);
-}
-
-SearchMode::Type InstantTestModelObserver::WaitForExpectedOverlayState() {
- run_loop_.Run();
- return observed_mode_type_;
-}
-
-void InstantTestModelObserver::OverlayStateChanged(
- const InstantOverlayModel& model) {
- observed_mode_type_ = model.mode().mode;
- run_loop_.Quit();
-}
-
// InstantTestBase -----------------------------------------------------------
void InstantTestBase::SetupInstant(Browser* browser) {
@@ -79,9 +52,7 @@ void InstantTestBase::SetupInstant(Browser* browser) {
service->Add(template_url); // Takes ownership of |template_url|.
service->SetDefaultSearchProvider(template_url);
- // TODO(shishir): Fix this ugly hack.
- instant()->SetInstantEnabled(false, true);
- instant()->SetInstantEnabled(true, false);
+ instant()->ReloadStaleNTP();
}
void InstantTestBase::SetInstantURL(const std::string& url) {
@@ -102,13 +73,6 @@ void InstantTestBase::Init(const GURL& instant_url) {
instant_url_ = instant_url;
}
-void InstantTestBase::KillInstantRenderView() {
- base::KillProcess(
- instant()->GetOverlayContents()->GetRenderProcessHost()->GetHandle(),
- content::RESULT_CODE_KILLED,
- false);
-}
-
void InstantTestBase::FocusOmnibox() {
// If the omnibox already has focus, just notify Instant.
if (omnibox()->model()->has_focus()) {
@@ -133,36 +97,6 @@ void InstantTestBase::SetOmniboxText(const std::string& text) {
omnibox()->SetUserText(UTF8ToUTF16(text));
}
-bool InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow(
- const std::string& text) {
- // The order of events may be:
- // { hide, show } or just { show } depending on the order things
- // flow in from GWS and Chrome's response to hiding the infobar and/or
- // bookmark bar. Note, the GWS response is relevant because of the
- // Instant "MANUAL_*" tests.
- InstantTestModelObserver first_observer(
- instant()->model(), SearchMode::MODE_DEFAULT);
- SetOmniboxText(text);
-
- SearchMode::Type observed = first_observer.WaitForExpectedOverlayState();
- if (observed == SearchMode::MODE_DEFAULT) {
- InstantTestModelObserver second_observer(
- instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS);
- observed = second_observer.WaitForExpectedOverlayState();
- }
- EXPECT_EQ(SearchMode::MODE_SEARCH_SUGGESTIONS, observed);
- return observed == SearchMode::MODE_SEARCH_SUGGESTIONS;
-}
-
-void InstantTestBase::SetOmniboxTextAndWaitForSuggestion(
- const std::string& text) {
- content::WindowedNotificationObserver observer(
- chrome::NOTIFICATION_INSTANT_SET_SUGGESTION,
- content::NotificationService::AllSources());
- SetOmniboxText(text);
- observer.Wait();
-}
-
void InstantTestBase::PressEnterAndWaitForNavigation() {
content::WindowedNotificationObserver nav_observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
@@ -193,7 +127,7 @@ bool InstantTestBase::GetStringFromJS(content::WebContents* contents,
}
bool InstantTestBase::ExecuteScript(const std::string& script) {
- return content::ExecuteScript(instant()->GetOverlayContents(), script);
+ return content::ExecuteScript(instant()->GetNTPContents(), script);
}
bool InstantTestBase::CheckVisibilityIs(content::WebContents* contents,
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698