OLD | NEW |
---|---|
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" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 class InstantModel; | 25 class InstantModel; |
26 class OmniboxView; | 26 class OmniboxView; |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 class WebContents; | 29 class WebContents; |
30 }; | 30 }; |
31 | 31 |
32 class InstantTestModelObserver : public InstantOverlayModelObserver { | 32 class InstantTestModelObserver : public InstantOverlayModelObserver { |
33 public: | 33 public: |
34 InstantTestModelObserver(InstantOverlayModel* model, | 34 InstantTestModelObserver(InstantOverlayModel* model, |
35 SearchMode::Type desired_mode_type); | 35 SearchMode::Type expected_mode_type); |
36 ~InstantTestModelObserver(); | 36 ~InstantTestModelObserver(); |
James Cook
2013/04/16 22:57:14
drive-by comment: needs "virtual"
dhollowa
2013/04/16 23:01:43
Done.
| |
37 | 37 |
38 void WaitForDesiredOverlayState(); | 38 // Returns true if the |expected_mode_type_| was observed in |
39 // OverlayStateChanged. | |
40 bool WaitForExpectedOverlayState(); | |
39 | 41 |
40 // Overridden from InstantOverlayModelObserver: | 42 // Overridden from InstantOverlayModelObserver: |
41 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE; | 43 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE; |
42 | 44 |
43 private: | 45 private: |
44 InstantOverlayModel* const model_; | 46 InstantOverlayModel* const model_; |
45 const SearchMode::Type desired_mode_type_; | 47 const SearchMode::Type expected_mode_type_; |
48 SearchMode::Type observed_mode_type_; | |
46 base::RunLoop run_loop_; | 49 base::RunLoop run_loop_; |
47 | 50 |
48 DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver); | 51 DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver); |
49 }; | 52 }; |
50 | 53 |
51 // This utility class is meant to be used in a "mix-in" fashion, giving the | 54 // This utility class is meant to be used in a "mix-in" fashion, giving the |
52 // derived test class additional Instant-related functionality. | 55 // derived test class additional Instant-related functionality. |
53 class InstantTestBase { | 56 class InstantTestBase { |
54 protected: | 57 protected: |
55 InstantTestBase() | 58 InstantTestBase() |
(...skipping 26 matching lines...) Expand all Loading... | |
82 | 85 |
83 net::TestServer& https_test_server() { return https_test_server_; } | 86 net::TestServer& https_test_server() { return https_test_server_; } |
84 | 87 |
85 void KillInstantRenderView(); | 88 void KillInstantRenderView(); |
86 | 89 |
87 void FocusOmnibox(); | 90 void FocusOmnibox(); |
88 void FocusOmniboxAndWaitForInstantSupport(); | 91 void FocusOmniboxAndWaitForInstantSupport(); |
89 void FocusOmniboxAndWaitForInstantExtendedSupport(); | 92 void FocusOmniboxAndWaitForInstantExtendedSupport(); |
90 | 93 |
91 void SetOmniboxText(const std::string& text); | 94 void SetOmniboxText(const std::string& text); |
92 void SetOmniboxTextAndWaitForOverlayToShow(const std::string& text); | 95 bool SetOmniboxTextAndWaitForOverlayToShow(const std::string& text); |
93 void SetOmniboxTextAndWaitForSuggestion(const std::string& text); | 96 void SetOmniboxTextAndWaitForSuggestion(const std::string& text); |
94 | 97 |
95 bool GetBoolFromJS(content::WebContents* contents, | 98 bool GetBoolFromJS(content::WebContents* contents, |
96 const std::string& script, | 99 const std::string& script, |
97 bool* result) WARN_UNUSED_RESULT; | 100 bool* result) WARN_UNUSED_RESULT; |
98 bool GetIntFromJS(content::WebContents* contents, | 101 bool GetIntFromJS(content::WebContents* contents, |
99 const std::string& script, | 102 const std::string& script, |
100 int* result) WARN_UNUSED_RESULT; | 103 int* result) WARN_UNUSED_RESULT; |
101 bool GetStringFromJS(content::WebContents* contents, | 104 bool GetStringFromJS(content::WebContents* contents, |
102 const std::string& script, | 105 const std::string& script, |
(...skipping 22 matching lines...) Expand all Loading... | |
125 | 128 |
126 Browser* browser_; | 129 Browser* browser_; |
127 | 130 |
128 // HTTPS Testing server, started on demand. | 131 // HTTPS Testing server, started on demand. |
129 net::TestServer https_test_server_; | 132 net::TestServer https_test_server_; |
130 | 133 |
131 DISALLOW_COPY_AND_ASSIGN(InstantTestBase); | 134 DISALLOW_COPY_AND_ASSIGN(InstantTestBase); |
132 }; | 135 }; |
133 | 136 |
134 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ | 137 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_TEST_UTILS_H_ |
OLD | NEW |