OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_VIEW_TEST_CLIENT_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ |
6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "third_party/WebKit/public/web/WebViewClient.h" | 9 #include "third_party/WebKit/public/web/WebViewClient.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 class WebView; | 12 class WebView; |
13 } // namespace blink | 13 } // namespace blink |
14 | 14 |
15 namespace test_runner { | 15 namespace test_runner { |
16 | 16 |
17 class EventSender; | 17 class EventSender; |
18 class TestRunner; | 18 class TestRunner; |
19 class WebTestDelegate; | 19 class WebTestDelegate; |
20 class WebTestProxyBase; | 20 class WebViewTestProxyBase; |
21 | 21 |
22 // WebViewTestClient implements WebViewClient interface, providing behavior | 22 // WebViewTestClient implements WebViewClient interface, providing behavior |
23 // expected by tests. WebViewTestClient ends up used by WebTestProxy | 23 // expected by tests. WebViewTestClient ends up used by WebViewTestProxy |
24 // which coordinates forwarding WebViewClient calls either to | 24 // which coordinates forwarding WebViewClient calls either to |
25 // WebViewTestClient or to the product code (i.e. to RenderViewImpl). | 25 // WebViewTestClient or to the product code (i.e. to RenderViewImpl). |
26 class WebViewTestClient : public blink::WebViewClient { | 26 class WebViewTestClient : public blink::WebViewClient { |
27 public: | 27 public: |
28 // Caller has to ensure that all arguments (i.e. |test_runner| and |delegate|) | 28 // Caller has to ensure that all arguments (i.e. |test_runner| and |delegate|) |
29 // live longer than |this|. | 29 // live longer than |this|. |
30 WebViewTestClient(TestRunner* test_runner, | 30 WebViewTestClient(TestRunner* test_runner, |
31 WebTestProxyBase* web_test_proxy_base); | 31 WebViewTestProxyBase* web_view_test_proxy_base); |
32 | 32 |
33 virtual ~WebViewTestClient(); | 33 virtual ~WebViewTestClient(); |
34 | 34 |
35 // WebViewClient overrides needed by WebTestProxy. | 35 // WebViewClient overrides needed by WebViewTestProxy. |
36 void showValidationMessage(const blink::WebRect& anchor_in_root_view, | 36 void showValidationMessage(const blink::WebRect& anchor_in_root_view, |
37 const blink::WebString& main_message, | 37 const blink::WebString& main_message, |
38 blink::WebTextDirection main_message_hint, | 38 blink::WebTextDirection main_message_hint, |
39 const blink::WebString& sub_message, | 39 const blink::WebString& sub_message, |
40 blink::WebTextDirection sub_message_hint) override; | 40 blink::WebTextDirection sub_message_hint) override; |
41 void startDragging(blink::WebLocalFrame* frame, | 41 void startDragging(blink::WebLocalFrame* frame, |
42 const blink::WebDragData& data, | 42 const blink::WebDragData& data, |
43 blink::WebDragOperationsMask mask, | 43 blink::WebDragOperationsMask mask, |
44 const blink::WebImage& image, | 44 const blink::WebImage& image, |
45 const blink::WebPoint& point) override; | 45 const blink::WebPoint& point) override; |
46 void didChangeContents() override; | 46 void didChangeContents() override; |
47 blink::WebView* createView(blink::WebLocalFrame* creator, | 47 blink::WebView* createView(blink::WebLocalFrame* creator, |
48 const blink::WebURLRequest& request, | 48 const blink::WebURLRequest& request, |
49 const blink::WebWindowFeatures& features, | 49 const blink::WebWindowFeatures& features, |
50 const blink::WebString& frame_name, | 50 const blink::WebString& frame_name, |
51 blink::WebNavigationPolicy policy, | 51 blink::WebNavigationPolicy policy, |
52 bool suppress_opener) override; | 52 bool suppress_opener) override; |
53 void setStatusText(const blink::WebString& text) override; | 53 void setStatusText(const blink::WebString& text) override; |
54 void printPage(blink::WebLocalFrame* frame) override; | 54 void printPage(blink::WebLocalFrame* frame) override; |
55 blink::WebSpeechRecognizer* speechRecognizer() override; | 55 blink::WebSpeechRecognizer* speechRecognizer() override; |
56 blink::WebString acceptLanguages() override; | 56 blink::WebString acceptLanguages() override; |
57 void didFocus() override; | 57 void didFocus() override; |
58 | 58 |
59 private: | 59 private: |
60 WebTestDelegate* delegate(); | 60 WebTestDelegate* delegate(); |
61 | 61 |
62 // Borrowed pointers to other parts of Layout Tests state. | 62 // Borrowed pointers to other parts of Layout Tests state. |
63 TestRunner* test_runner_; | 63 TestRunner* test_runner_; |
64 WebTestProxyBase* web_test_proxy_base_; | 64 WebViewTestProxyBase* web_view_test_proxy_base_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(WebViewTestClient); | 66 DISALLOW_COPY_AND_ASSIGN(WebViewTestClient); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace test_runner | 69 } // namespace test_runner |
70 | 70 |
71 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ | 71 #endif // COMPONENTS_TEST_RUNNER_WEB_VIEW_TEST_CLIENT_H_ |
OLD | NEW |