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

Side by Side Diff: chrome/browser/ui/search/instant_test_utils.h

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, 5 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_instant_controller.h" 15 #include "chrome/browser/ui/browser_instant_controller.h"
16 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/omnibox/location_bar.h" 17 #include "chrome/browser/ui/omnibox/location_bar.h"
18 #include "chrome/browser/ui/search/instant_controller.h" 18 #include "chrome/browser/ui/search/instant_controller.h"
19 #include "chrome/browser/ui/search/instant_overlay_model_observer.h"
20 #include "chrome/common/search_types.h" 19 #include "chrome/common/search_types.h"
21 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
22 #include "net/test/spawned_test_server/spawned_test_server.h" 21 #include "net/test/spawned_test_server/spawned_test_server.h"
23 22
24 class BrowserInstantController; 23 class BrowserInstantController;
25 class InstantController; 24 class InstantController;
26 class InstantModel; 25 class InstantModel;
27 class OmniboxView; 26 class OmniboxView;
28 27
29 namespace content { 28 namespace content {
30 class WebContents; 29 class WebContents;
31 }; 30 };
32 31
33 class InstantTestModelObserver : public InstantOverlayModelObserver {
34 public:
35 InstantTestModelObserver(InstantOverlayModel* model,
36 SearchMode::Type expected_mode_type);
37 virtual ~InstantTestModelObserver();
38
39 // Returns the observed mode type, may be different than the
40 // |expected_mode_type_| that was observed in OverlayStateChanged.
41 SearchMode::Type WaitForExpectedOverlayState();
42
43 // Overridden from InstantOverlayModelObserver:
44 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE;
45
46 private:
47 InstantOverlayModel* const model_;
48 const SearchMode::Type expected_mode_type_;
49 SearchMode::Type observed_mode_type_;
50 base::RunLoop run_loop_;
51
52 DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver);
53 };
54
55 // This utility class is meant to be used in a "mix-in" fashion, giving the 32 // This utility class is meant to be used in a "mix-in" fashion, giving the
56 // derived test class additional Instant-related functionality. 33 // derived test class additional Instant-related functionality.
57 class InstantTestBase { 34 class InstantTestBase {
58 protected: 35 protected:
59 InstantTestBase() 36 InstantTestBase()
60 : https_test_server_( 37 : https_test_server_(
61 net::SpawnedTestServer::TYPE_HTTPS, 38 net::SpawnedTestServer::TYPE_HTTPS,
62 net::BaseTestServer::SSLOptions(), 39 net::BaseTestServer::SSLOptions(),
63 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { 40 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
64 } 41 }
(...skipping 24 matching lines...) Expand all
89 const GURL& instant_url() const { return instant_url_; } 66 const GURL& instant_url() const { return instant_url_; }
90 67
91 net::SpawnedTestServer& https_test_server() { return https_test_server_; } 68 net::SpawnedTestServer& https_test_server() { return https_test_server_; }
92 69
93 void KillInstantRenderView(); 70 void KillInstantRenderView();
94 71
95 void FocusOmnibox(); 72 void FocusOmnibox();
96 void FocusOmniboxAndWaitForInstantNTPSupport(); 73 void FocusOmniboxAndWaitForInstantNTPSupport();
97 74
98 void SetOmniboxText(const std::string& text); 75 void SetOmniboxText(const std::string& text);
99 bool SetOmniboxTextAndWaitForOverlayToShow(const std::string& text);
100 void SetOmniboxTextAndWaitForSuggestion(const std::string& text);
101 76
102 void PressEnterAndWaitForNavigation(); 77 void PressEnterAndWaitForNavigation();
103 78
104 bool GetBoolFromJS(content::WebContents* contents, 79 bool GetBoolFromJS(content::WebContents* contents,
105 const std::string& script, 80 const std::string& script,
106 bool* result) WARN_UNUSED_RESULT; 81 bool* result) WARN_UNUSED_RESULT;
107 bool GetIntFromJS(content::WebContents* contents, 82 bool GetIntFromJS(content::WebContents* contents,
108 const std::string& script, 83 const std::string& script,
109 int* result) WARN_UNUSED_RESULT; 84 int* result) WARN_UNUSED_RESULT;
110 bool GetStringFromJS(content::WebContents* contents, 85 bool GetStringFromJS(content::WebContents* contents,
(...skipping 25 matching lines...) Expand all
136 111
137 Browser* browser_; 112 Browser* browser_;
138 113
139 // HTTPS Testing server, started on demand. 114 // HTTPS Testing server, started on demand.
140 net::SpawnedTestServer https_test_server_; 115 net::SpawnedTestServer https_test_server_;
141 116
142 DISALLOW_COPY_AND_ASSIGN(InstantTestBase); 117 DISALLOW_COPY_AND_ASSIGN(InstantTestBase);
143 }; 118 };
144 119
145 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ 120 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_page_unittest.cc ('k') | chrome/browser/ui/search/instant_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698