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

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: Rebase. 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 InstantController; 23 class InstantController;
25 class InstantModel; 24 class InstantModel;
26 class OmniboxView; 25 class OmniboxView;
27 26
28 namespace content { 27 namespace content {
29 class WebContents; 28 class WebContents;
30 }; 29 };
31 30
32 class InstantTestModelObserver : public InstantOverlayModelObserver {
33 public:
34 InstantTestModelObserver(InstantOverlayModel* model,
35 SearchMode::Type expected_mode_type);
36 virtual ~InstantTestModelObserver();
37
38 // Returns the observed mode type, may be different than the
39 // |expected_mode_type_| that was observed in OverlayStateChanged.
40 SearchMode::Type WaitForExpectedOverlayState();
41
42 // Overridden from InstantOverlayModelObserver:
43 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE;
44
45 private:
46 InstantOverlayModel* const model_;
47 const SearchMode::Type expected_mode_type_;
48 SearchMode::Type observed_mode_type_;
49 base::RunLoop run_loop_;
50
51 DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver);
52 };
53
54 // This utility class is meant to be used in a "mix-in" fashion, giving the 31 // This utility class is meant to be used in a "mix-in" fashion, giving the
55 // derived test class additional Instant-related functionality. 32 // derived test class additional Instant-related functionality.
56 class InstantTestBase { 33 class InstantTestBase {
57 protected: 34 protected:
58 InstantTestBase() 35 InstantTestBase()
59 : https_test_server_( 36 : https_test_server_(
60 net::SpawnedTestServer::TYPE_HTTPS, 37 net::SpawnedTestServer::TYPE_HTTPS,
61 net::BaseTestServer::SSLOptions(), 38 net::BaseTestServer::SSLOptions(),
62 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { 39 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
63 } 40 }
(...skipping 20 matching lines...) Expand all
84 const GURL& instant_url() const { return instant_url_; } 61 const GURL& instant_url() const { return instant_url_; }
85 62
86 net::SpawnedTestServer& https_test_server() { return https_test_server_; } 63 net::SpawnedTestServer& https_test_server() { return https_test_server_; }
87 64
88 void KillInstantRenderView(); 65 void KillInstantRenderView();
89 66
90 void FocusOmnibox(); 67 void FocusOmnibox();
91 void FocusOmniboxAndWaitForInstantNTPSupport(); 68 void FocusOmniboxAndWaitForInstantNTPSupport();
92 69
93 void SetOmniboxText(const std::string& text); 70 void SetOmniboxText(const std::string& text);
94 bool SetOmniboxTextAndWaitForOverlayToShow(const std::string& text);
95 void SetOmniboxTextAndWaitForSuggestion(const std::string& text);
96 71
97 void PressEnterAndWaitForNavigation(); 72 void PressEnterAndWaitForNavigation();
98 73
99 bool GetBoolFromJS(content::WebContents* contents, 74 bool GetBoolFromJS(content::WebContents* contents,
100 const std::string& script, 75 const std::string& script,
101 bool* result) WARN_UNUSED_RESULT; 76 bool* result) WARN_UNUSED_RESULT;
102 bool GetIntFromJS(content::WebContents* contents, 77 bool GetIntFromJS(content::WebContents* contents,
103 const std::string& script, 78 const std::string& script,
104 int* result) WARN_UNUSED_RESULT; 79 int* result) WARN_UNUSED_RESULT;
105 bool GetStringFromJS(content::WebContents* contents, 80 bool GetStringFromJS(content::WebContents* contents,
(...skipping 23 matching lines...) Expand all
129 104
130 Browser* browser_; 105 Browser* browser_;
131 106
132 // HTTPS Testing server, started on demand. 107 // HTTPS Testing server, started on demand.
133 net::SpawnedTestServer https_test_server_; 108 net::SpawnedTestServer https_test_server_;
134 109
135 DISALLOW_COPY_AND_ASSIGN(InstantTestBase); 110 DISALLOW_COPY_AND_ASSIGN(InstantTestBase);
136 }; 111 };
137 112
138 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ 113 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698