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

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

Issue 2669973003: Cleanup: Remove unused stuff from InstantTestUtils (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_test_utils.cc » ('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 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/compiler_specific.h"
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "base/metrics/field_trial.h"
13 #include "base/run_loop.h"
14 #include "base/strings/string16.h"
15 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_instant_controller.h" 12 #include "chrome/browser/ui/browser_instant_controller.h"
17 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/location_bar/location_bar.h" 14 #include "chrome/browser/ui/location_bar/location_bar.h"
19 #include "chrome/browser/ui/search/instant_controller.h" 15 #include "chrome/browser/ui/search/instant_controller.h"
20 #include "chrome/common/search/search_types.h"
21 #include "net/test/embedded_test_server/embedded_test_server.h" 16 #include "net/test/embedded_test_server/embedded_test_server.h"
22 #include "url/gurl.h" 17 #include "url/gurl.h"
23 18
24 class BrowserInstantController;
25 class InstantController;
26 class OmniboxView; 19 class OmniboxView;
27 20
28 namespace content { 21 namespace content {
29 class WebContents; 22 class WebContents;
30 }; 23 };
31 24
32 // This utility class is meant to be used in a "mix-in" fashion, giving the 25 // This utility class is meant to be used in a "mix-in" fashion, giving the
33 // derived test class additional Instant-related functionality. 26 // derived test class additional Instant-related functionality.
34 class InstantTestBase { 27 class InstantTestBase {
35 protected: 28 protected:
36 InstantTestBase(); 29 InstantTestBase();
37 virtual ~InstantTestBase(); 30 virtual ~InstantTestBase();
38 31
39 protected: 32 protected:
40 void SetupInstant(Browser* browser); 33 void SetupInstant(Browser* browser);
41 void Init(const GURL& instant_url, const GURL& ntp_url, 34 void Init(const GURL& instant_url, const GURL& ntp_url,
42 bool init_suggestions_url); 35 bool init_suggestions_url);
43 36
44 void SetInstantURL(const std::string& url);
45
46 void set_browser(Browser* browser) { 37 void set_browser(Browser* browser) {
47 browser_ = browser; 38 browser_ = browser;
48 } 39 }
49 40
50 BrowserInstantController* browser_instant() {
51 return browser_->instant_controller();
52 }
53
54 InstantController* instant() {
55 return browser_->instant_controller()->instant();
56 }
57
58 OmniboxView* omnibox() { 41 OmniboxView* omnibox() {
59 return browser_->window()->GetLocationBar()->GetOmniboxView(); 42 return browser_->window()->GetLocationBar()->GetOmniboxView();
60 } 43 }
61 44
62 const GURL& instant_url() const { return instant_url_; } 45 const GURL& instant_url() const { return instant_url_; }
63 46
64 const GURL& ntp_url() const { return ntp_url_; } 47 const GURL& ntp_url() const { return ntp_url_; }
65 48
66 net::EmbeddedTestServer& https_test_server() { return https_test_server_; } 49 net::EmbeddedTestServer& https_test_server() { return https_test_server_; }
67 50
68 void KillInstantRenderView();
69
70 void FocusOmnibox(); 51 void FocusOmnibox();
71 52
72 void SetOmniboxText(const std::string& text); 53 void SetOmniboxText(const std::string& text);
73 54
74 void PressEnterAndWaitForNavigation(); 55 void PressEnterAndWaitForNavigation();
75 void PressEnterAndWaitForFrameLoad(); 56 void PressEnterAndWaitForFrameLoad();
76 57
77 bool GetBoolFromJS(content::WebContents* contents, 58 bool GetBoolFromJS(content::WebContents* contents,
78 const std::string& script, 59 const std::string& script,
79 bool* result) WARN_UNUSED_RESULT; 60 bool* result) WARN_UNUSED_RESULT;
80 bool GetIntFromJS(content::WebContents* contents, 61 bool GetIntFromJS(content::WebContents* contents,
81 const std::string& script, 62 const std::string& script,
82 int* result) WARN_UNUSED_RESULT; 63 int* result) WARN_UNUSED_RESULT;
83 bool GetStringFromJS(content::WebContents* contents, 64 bool GetStringFromJS(content::WebContents* contents,
84 const std::string& script, 65 const std::string& script,
85 std::string* result) WARN_UNUSED_RESULT; 66 std::string* result) WARN_UNUSED_RESULT;
86 bool CheckVisibilityIs(content::WebContents* contents,
87 bool expected) WARN_UNUSED_RESULT;
88 67
89 std::string GetOmniboxText(); 68 std::string GetOmniboxText();
90 69
91 // Loads a named image from url |image| from the given |rvh| host. |loaded| 70 // Loads a named image from url |image| from the given |rvh| host. |loaded|
92 // returns whether the image was able to load without error. 71 // returns whether the image was able to load without error.
93 // The method returns true if the JavaScript executed cleanly. 72 // The method returns true if the JavaScript executed cleanly.
94 bool LoadImage(content::RenderViewHost* rvh, 73 bool LoadImage(content::RenderViewHost* rvh,
95 const std::string& image, 74 const std::string& image,
96 bool* loaded); 75 bool* loaded);
97 76
98 // Returns the omnibox's inline autocompletion (shown in blue highlight).
99 base::string16 GetBlueText();
100
101 private: 77 private:
102 GURL instant_url_; 78 GURL instant_url_;
103 GURL ntp_url_; 79 GURL ntp_url_;
104 80
105 Browser* browser_; 81 Browser* browser_;
106 82
107 // HTTPS Testing server, started on demand. 83 // HTTPS Testing server, started on demand.
108 net::EmbeddedTestServer https_test_server_; 84 net::EmbeddedTestServer https_test_server_;
109 85
110 // Set to true to initialize suggestions URL in default search provider. 86 // Set to true to initialize suggestions URL in default search provider.
111 bool init_suggestions_url_; 87 bool init_suggestions_url_;
112 88
113 DISALLOW_COPY_AND_ASSIGN(InstantTestBase); 89 DISALLOW_COPY_AND_ASSIGN(InstantTestBase);
114 }; 90 };
115 91
116 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ 92 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698