| 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_FRAME_TEST_CLIENT_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "third_party/WebKit/public/web/WebFrameClient.h" | 12 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 13 | 13 |
| 14 namespace test_runner { | 14 namespace test_runner { |
| 15 | 15 |
| 16 class AccessibilityController; | 16 class AccessibilityController; |
| 17 class EventSender; | |
| 18 class TestRunner; | 17 class TestRunner; |
| 19 class WebTestDelegate; | 18 class WebTestDelegate; |
| 19 class WebTestProxyBase; |
| 20 | 20 |
| 21 // WebFrameTestClient implements WebFrameClient interface, providing behavior | 21 // WebFrameTestClient implements WebFrameClient interface, providing behavior |
| 22 // expected by tests. WebFrameTestClient ends up used by WebFrameTestProxy | 22 // expected by tests. WebFrameTestClient ends up used by WebFrameTestProxy |
| 23 // which coordinates forwarding WebFrameClient calls either to | 23 // which coordinates forwarding WebFrameClient calls either to |
| 24 // WebFrameTestClient or to the product code (i.e. to RenderFrameImpl). | 24 // WebFrameTestClient or to the product code (i.e. to RenderFrameImpl). |
| 25 class WebFrameTestClient : public blink::WebFrameClient { | 25 class WebFrameTestClient : public blink::WebFrameClient { |
| 26 public: | 26 public: |
| 27 // Caller has to ensure that all arguments (|test_runner|, |delegate| and so | 27 // Caller has to ensure that all arguments (|test_runner|, |delegate| and so |
| 28 // forth) live longer than |this|. | 28 // forth) live longer than |this|. |
| 29 WebFrameTestClient(TestRunner* test_runner, | 29 WebFrameTestClient(TestRunner* test_runner, |
| 30 WebTestDelegate* delegate, | 30 WebTestDelegate* delegate, |
| 31 AccessibilityController* accessibility_controller, | 31 AccessibilityController* accessibility_controller, |
| 32 EventSender* event_sender); | 32 WebTestProxyBase* web_test_proxy_base); |
| 33 | 33 |
| 34 ~WebFrameTestClient() override; | 34 ~WebFrameTestClient() override; |
| 35 | 35 |
| 36 // WebFrameClient overrides needed by WebFrameTestProxy. | 36 // WebFrameClient overrides needed by WebFrameTestProxy. |
| 37 blink::WebColorChooser* createColorChooser( | 37 blink::WebColorChooser* createColorChooser( |
| 38 blink::WebColorChooserClient* client, | 38 blink::WebColorChooserClient* client, |
| 39 const blink::WebColor& initial_color, | 39 const blink::WebColor& initial_color, |
| 40 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override; | 40 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override; |
| 41 void runModalAlertDialog(const blink::WebString& message) override; | 41 void runModalAlertDialog(const blink::WebString& message) override; |
| 42 bool runModalConfirmDialog(const blink::WebString& message) override; | 42 bool runModalConfirmDialog(const blink::WebString& message) override; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 const blink::WebFrameClient::NavigationPolicyInfo& info) override; | 101 const blink::WebFrameClient::NavigationPolicyInfo& info) override; |
| 102 bool willCheckAndDispatchMessageEvent( | 102 bool willCheckAndDispatchMessageEvent( |
| 103 blink::WebLocalFrame* source_frame, | 103 blink::WebLocalFrame* source_frame, |
| 104 blink::WebFrame* target_frame, | 104 blink::WebFrame* target_frame, |
| 105 blink::WebSecurityOrigin target, | 105 blink::WebSecurityOrigin target, |
| 106 blink::WebDOMMessageEvent event) override; | 106 blink::WebDOMMessageEvent event) override; |
| 107 void checkIfAudioSinkExistsAndIsAuthorized( | 107 void checkIfAudioSinkExistsAndIsAuthorized( |
| 108 const blink::WebString& sink_id, | 108 const blink::WebString& sink_id, |
| 109 const blink::WebSecurityOrigin& security_origin, | 109 const blink::WebSecurityOrigin& security_origin, |
| 110 blink::WebSetSinkIdCallbacks* web_callbacks) override; | 110 blink::WebSetSinkIdCallbacks* web_callbacks) override; |
| 111 void didClearWindowObject(blink::WebLocalFrame* frame) override; |
| 111 | 112 |
| 112 private: | 113 private: |
| 113 // Borrowed pointers to other parts of Layout Tests state. | 114 // Borrowed pointers to other parts of Layout Tests state. |
| 114 TestRunner* test_runner_; | 115 TestRunner* test_runner_; |
| 115 WebTestDelegate* delegate_; | 116 WebTestDelegate* delegate_; |
| 116 AccessibilityController* accessibility_controller_; | 117 AccessibilityController* accessibility_controller_; |
| 117 EventSender* event_sender_; | 118 WebTestProxyBase* web_test_proxy_base_; |
| 118 | 119 |
| 119 // Map from request identifier into resource url description. The map is used | 120 // Map from request identifier into resource url description. The map is used |
| 120 // to track resource requests spanning willSendRequest, didReceiveResponse, | 121 // to track resource requests spanning willSendRequest, didReceiveResponse, |
| 121 // didChangeResourcePriority, didFinishResourceLoad. | 122 // didChangeResourcePriority, didFinishResourceLoad. |
| 122 std::map<unsigned, std::string> resource_identifier_map_; | 123 std::map<unsigned, std::string> resource_identifier_map_; |
| 123 | 124 |
| 124 DISALLOW_COPY_AND_ASSIGN(WebFrameTestClient); | 125 DISALLOW_COPY_AND_ASSIGN(WebFrameTestClient); |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 } // namespace test_runner | 128 } // namespace test_runner |
| 128 | 129 |
| 129 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ | 130 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ |
| OLD | NEW |