OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ | |
6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "third_party/WebKit/public/web/WebViewClient.h" | |
10 | |
11 namespace blink { | |
12 class WebView; | |
13 } // namespace blink | |
14 | |
15 namespace test_runner { | |
16 | |
17 class TestRunner; | |
18 class WebTestDelegate; | |
19 class WebViewTestProxyBase; | |
20 | |
21 // WebViewTestClient implements WebViewClient interface, providing behavior | |
22 // expected by tests. WebViewTestClient ends up used by WebViewTestProxy | |
23 // which coordinates forwarding WebViewClient calls either to | |
24 // WebViewTestClient or to the product code (i.e. to RenderViewImpl). | |
25 class WebViewTestClient : public blink::WebViewClient { | |
26 public: | |
27 // Caller has to ensure |web_view_test_proxy_base| lives longer than |this|. | |
28 WebViewTestClient(WebViewTestProxyBase* web_view_test_proxy_base); | |
29 | |
30 virtual ~WebViewTestClient(); | |
31 | |
32 // WebViewClient overrides needed by WebViewTestProxy. | |
33 void showValidationMessage(const blink::WebRect& anchor_in_root_view, | |
34 const blink::WebString& main_message, | |
35 blink::WebTextDirection main_message_hint, | |
36 const blink::WebString& sub_message, | |
37 blink::WebTextDirection sub_message_hint) override; | |
38 void didChangeContents() override; | |
39 blink::WebView* createView(blink::WebLocalFrame* creator, | |
40 const blink::WebURLRequest& request, | |
41 const blink::WebWindowFeatures& features, | |
42 const blink::WebString& frame_name, | |
43 blink::WebNavigationPolicy policy, | |
44 bool suppress_opener) override; | |
45 void setStatusText(const blink::WebString& text) override; | |
46 void printPage(blink::WebLocalFrame* frame) override; | |
47 blink::WebSpeechRecognizer* speechRecognizer() override; | |
48 blink::WebString acceptLanguages() override; | |
49 void didFocus() override; | |
50 | |
51 private: | |
52 WebTestDelegate* delegate(); | |
53 TestRunner* test_runner(); | |
54 | |
55 // Borrowed pointer to WebViewTestProxyBase. | |
56 WebViewTestProxyBase* web_view_test_proxy_base_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(WebViewTestClient); | |
59 }; | |
60 | |
61 } // namespace test_runner | |
62 | |
63 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ | |
OLD | NEW |