OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "components/test_runner/mock_screen_orientation_client.h" | 9 #include "components/test_runner/mock_screen_orientation_client.h" |
10 #include "components/test_runner/test_interfaces.h" | |
11 #include "components/test_runner/test_runner.h" | |
12 #include "components/test_runner/web_test_delegate.h" | 10 #include "components/test_runner/web_test_delegate.h" |
| 11 #include "components/test_runner/web_test_interfaces.h" |
13 #include "components/test_runner/web_test_proxy.h" | 12 #include "components/test_runner/web_test_proxy.h" |
| 13 #include "components/test_runner/web_test_runner.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
15 | 15 |
16 namespace test_runner { | 16 namespace test_runner { |
17 | 17 |
18 // Templetized wrapper around RenderFrameImpl objects, which implement | 18 // Templetized wrapper around RenderFrameImpl objects, which implement |
19 // the WebFrameClient interface. | 19 // the WebFrameClient interface. |
20 template <class Base, typename P, typename R> | 20 template <class Base, typename P, typename R> |
21 class WebFrameTestProxy : public Base { | 21 class WebFrameTestProxy : public Base { |
22 public: | 22 public: |
23 WebFrameTestProxy(P p, R r) : Base(p, r), base_proxy_(NULL) {} | 23 WebFrameTestProxy(P p, R r) : Base(p, r), base_proxy_(NULL) {} |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 virtual blink::WebColorChooser* createColorChooser( | 140 virtual blink::WebColorChooser* createColorChooser( |
141 blink::WebColorChooserClient* client, | 141 blink::WebColorChooserClient* client, |
142 const blink::WebColor& initial_color, | 142 const blink::WebColor& initial_color, |
143 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { | 143 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { |
144 return base_proxy_->CreateColorChooser(client, initial_color, suggestions); | 144 return base_proxy_->CreateColorChooser(client, initial_color, suggestions); |
145 } | 145 } |
146 | 146 |
147 virtual void runModalAlertDialog(const blink::WebString& message) { | 147 virtual void runModalAlertDialog(const blink::WebString& message) { |
148 base_proxy_->delegate_->PrintMessage(std::string("ALERT: ") + | 148 base_proxy_->GetDelegate()->PrintMessage(std::string("ALERT: ") + |
149 message.utf8().data() + "\n"); | 149 message.utf8().data() + "\n"); |
150 } | 150 } |
151 | 151 |
152 virtual bool runModalConfirmDialog(const blink::WebString& message) { | 152 virtual bool runModalConfirmDialog(const blink::WebString& message) { |
153 base_proxy_->delegate_->PrintMessage(std::string("CONFIRM: ") + | 153 base_proxy_->GetDelegate()->PrintMessage(std::string("CONFIRM: ") + |
154 message.utf8().data() + "\n"); | 154 message.utf8().data() + "\n"); |
155 return true; | 155 return true; |
156 } | 156 } |
157 | 157 |
158 virtual bool runModalPromptDialog(const blink::WebString& message, | 158 virtual bool runModalPromptDialog(const blink::WebString& message, |
159 const blink::WebString& default_value, | 159 const blink::WebString& default_value, |
160 blink::WebString*) { | 160 blink::WebString*) { |
161 base_proxy_->delegate_->PrintMessage( | 161 base_proxy_->GetDelegate()->PrintMessage( |
162 std::string("PROMPT: ") + message.utf8().data() + ", default text: " + | 162 std::string("PROMPT: ") + message.utf8().data() + ", default text: " + |
163 default_value.utf8().data() + "\n"); | 163 default_value.utf8().data() + "\n"); |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 virtual bool runModalBeforeUnloadDialog(bool is_reload, | 167 virtual bool runModalBeforeUnloadDialog(bool is_reload, |
168 const blink::WebString& message) { | 168 const blink::WebString& message) { |
169 base_proxy_->delegate_->PrintMessage(std::string("CONFIRM NAVIGATION: ") + | 169 base_proxy_->GetDelegate()->PrintMessage( |
170 message.utf8().data() + "\n"); | 170 std::string("CONFIRM NAVIGATION: ") + message.utf8().data() + "\n"); |
171 return !base_proxy_->test_interfaces_->GetTestRunner() | 171 return !base_proxy_->GetInterfaces() |
172 ->shouldStayOnPageAfterHandlingBeforeUnload(); | 172 ->TestRunner() |
| 173 ->ShouldStayOnPageAfterHandlingBeforeUnload(); |
173 } | 174 } |
174 | 175 |
175 virtual void showContextMenu( | 176 virtual void showContextMenu( |
176 const blink::WebContextMenuData& context_menu_data) { | 177 const blink::WebContextMenuData& context_menu_data) { |
177 base_proxy_->ShowContextMenu(Base::GetWebFrame(), | 178 base_proxy_->ShowContextMenu(Base::GetWebFrame(), |
178 context_menu_data); | 179 context_menu_data); |
179 Base::showContextMenu(context_menu_data); | 180 Base::showContextMenu(context_menu_data); |
180 } | 181 } |
181 | 182 |
182 virtual void didDetectXSS(blink::WebLocalFrame* frame, | 183 virtual void didDetectXSS(blink::WebLocalFrame* frame, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 284 |
284 private: | 285 private: |
285 WebTestProxyBase* base_proxy_; | 286 WebTestProxyBase* base_proxy_; |
286 | 287 |
287 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); | 288 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); |
288 }; | 289 }; |
289 | 290 |
290 } // namespace test_runner | 291 } // namespace test_runner |
291 | 292 |
292 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 293 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
OLD | NEW |