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_WIDGET_TEST_CLIENT_H_ | |
6 #define COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "third_party/WebKit/public/web/WebWidgetClient.h" | |
11 | |
12 namespace test_runner { | |
13 | |
14 class TestRunner; | |
15 class TestRunnerForSpecificView; | |
16 class WebTestDelegate; | |
17 class WebWidgetTestProxyBase; | |
18 | |
19 // WebWidgetTestClient implements WebWidgetClient interface, providing behavior | |
20 // expected by tests. WebWidgetTestClient ends up used by WebViewTestProxy | |
21 // which coordinates forwarding WebWidgetClient calls either to | |
22 // WebWidgetTestClient or to the product code (i.e. currently to | |
23 // RenderViewImpl). | |
24 class WebWidgetTestClient : public blink::WebWidgetClient { | |
25 public: | |
26 // Caller has to ensure that all arguments (i.e. |test_runner| and |delegate|) | |
27 // live longer than |this|. | |
28 WebWidgetTestClient(WebWidgetTestProxyBase* web_widget_test_proxy_base); | |
29 | |
30 virtual ~WebWidgetTestClient(); | |
31 | |
32 // WebWidgetClient overrides needed by WebWidgetTestProxy. | |
33 blink::WebScreenInfo screenInfo() override; | |
34 void scheduleAnimation() override; | |
35 bool requestPointerLock() override; | |
36 void requestPointerUnlock() override; | |
37 bool isPointerLocked() override; | |
38 void setToolTipText(const blink::WebString& text, | |
39 blink::WebTextDirection direction) override; | |
40 void startDragging(blink::WebReferrerPolicy policy, | |
41 const blink::WebDragData& data, | |
42 blink::WebDragOperationsMask mask, | |
43 const blink::WebImage& image, | |
44 const blink::WebPoint& point) override; | |
45 | |
46 private: | |
47 void AnimateNow(); | |
48 | |
49 WebTestDelegate* delegate(); | |
50 TestRunnerForSpecificView* view_test_runner(); | |
51 TestRunner* test_runner(); | |
52 | |
53 // Borrowed pointer to WebWidgetTestProxyBase. | |
54 WebWidgetTestProxyBase* web_widget_test_proxy_base_; | |
55 | |
56 bool animation_scheduled_; | |
57 | |
58 base::WeakPtrFactory<WebWidgetTestClient> weak_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(WebWidgetTestClient); | |
61 }; | |
62 | |
63 } // namespace test_runner | |
64 | |
65 #endif // COMPONENTS_TEST_RUNNER_WEB_WIDGET_TEST_CLIENT_H_ | |
OLD | NEW |