| 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_FRAME_TEST_CLIENT_H_ | |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "third_party/WebKit/public/web/WebFrameClient.h" | |
| 13 | |
| 14 namespace test_runner { | |
| 15 | |
| 16 class TestRunner; | |
| 17 class WebFrameTestProxyBase; | |
| 18 class WebTestDelegate; | |
| 19 class WebViewTestProxyBase; | |
| 20 | |
| 21 // WebFrameTestClient implements WebFrameClient interface, providing behavior | |
| 22 // expected by tests. WebFrameTestClient ends up used by WebFrameTestProxy | |
| 23 // which coordinates forwarding WebFrameClient calls either to | |
| 24 // WebFrameTestClient or to the product code (i.e. to RenderFrameImpl). | |
| 25 class WebFrameTestClient : public blink::WebFrameClient { | |
| 26 public: | |
| 27 // Caller has to ensure that all arguments (|delegate|, | |
| 28 // |web_view_test_proxy_base_| and so forth) live longer than |this|. | |
| 29 WebFrameTestClient(WebTestDelegate* delegate, | |
| 30 WebViewTestProxyBase* web_view_test_proxy_base, | |
| 31 WebFrameTestProxyBase* web_frame_test_proxy_base); | |
| 32 | |
| 33 ~WebFrameTestClient() override; | |
| 34 | |
| 35 // WebFrameClient overrides needed by WebFrameTestProxy. | |
| 36 blink::WebColorChooser* createColorChooser( | |
| 37 blink::WebColorChooserClient* client, | |
| 38 const blink::WebColor& initial_color, | |
| 39 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override; | |
| 40 void runModalAlertDialog(const blink::WebString& message) override; | |
| 41 bool runModalConfirmDialog(const blink::WebString& message) override; | |
| 42 bool runModalPromptDialog(const blink::WebString& message, | |
| 43 const blink::WebString& default_value, | |
| 44 blink::WebString* actual_value) override; | |
| 45 bool runModalBeforeUnloadDialog(bool is_reload) override; | |
| 46 blink::WebScreenOrientationClient* webScreenOrientationClient() override; | |
| 47 void postAccessibilityEvent(const blink::WebAXObject& object, | |
| 48 blink::WebAXEvent event) override; | |
| 49 void didChangeSelection(bool is_selection_empty) override; | |
| 50 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, | |
| 51 const blink::WebPluginParams& params) override; | |
| 52 void showContextMenu( | |
| 53 const blink::WebContextMenuData& context_menu_data) override; | |
| 54 blink::WebUserMediaClient* userMediaClient() override; | |
| 55 void didAddMessageToConsole(const blink::WebConsoleMessage& message, | |
| 56 const blink::WebString& source_name, | |
| 57 unsigned source_line, | |
| 58 const blink::WebString& stack_trace) override; | |
| 59 void loadURLExternally(const blink::WebURLRequest& request, | |
| 60 blink::WebNavigationPolicy policy, | |
| 61 const blink::WebString& suggested_name, | |
| 62 bool replaces_current_history_item) override; | |
| 63 void loadErrorPage(int reason) override; | |
| 64 void didStartProvisionalLoad(blink::WebDataSource* data_source) override; | |
| 65 void didReceiveServerRedirectForProvisionalLoad( | |
| 66 blink::WebLocalFrame* frame) override; | |
| 67 void didFailProvisionalLoad(blink::WebLocalFrame* frame, | |
| 68 const blink::WebURLError& error, | |
| 69 blink::WebHistoryCommitType commit_type) override; | |
| 70 void didCommitProvisionalLoad( | |
| 71 blink::WebLocalFrame* frame, | |
| 72 const blink::WebHistoryItem& history_item, | |
| 73 blink::WebHistoryCommitType history_type) override; | |
| 74 void didReceiveTitle(blink::WebLocalFrame* frame, | |
| 75 const blink::WebString& title, | |
| 76 blink::WebTextDirection direction) override; | |
| 77 void didChangeIcon(blink::WebLocalFrame* frame, | |
| 78 blink::WebIconURL::Type icon_type) override; | |
| 79 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override; | |
| 80 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override; | |
| 81 void didFailLoad(blink::WebLocalFrame* frame, | |
| 82 const blink::WebURLError& error, | |
| 83 blink::WebHistoryCommitType commit_type) override; | |
| 84 void didFinishLoad(blink::WebLocalFrame* frame) override; | |
| 85 void didNavigateWithinPage(blink::WebLocalFrame* frame, | |
| 86 const blink::WebHistoryItem& history_item, | |
| 87 blink::WebHistoryCommitType commit_type, | |
| 88 bool contentInitiated) override; | |
| 89 void didStartLoading(bool to_different_document) override; | |
| 90 void didStopLoading() override; | |
| 91 void didDetectXSS(const blink::WebURL& insecure_url, | |
| 92 bool did_block_entire_page) override; | |
| 93 void didDispatchPingLoader(const blink::WebURL& url) override; | |
| 94 void willSendRequest(blink::WebLocalFrame* frame, | |
| 95 blink::WebURLRequest& request) override; | |
| 96 void didReceiveResponse(const blink::WebURLResponse& response) override; | |
| 97 blink::WebNavigationPolicy decidePolicyForNavigation( | |
| 98 const blink::WebFrameClient::NavigationPolicyInfo& info) override; | |
| 99 void checkIfAudioSinkExistsAndIsAuthorized( | |
| 100 const blink::WebString& sink_id, | |
| 101 const blink::WebSecurityOrigin& security_origin, | |
| 102 blink::WebSetSinkIdCallbacks* web_callbacks) override; | |
| 103 void didClearWindowObject(blink::WebLocalFrame* frame) override; | |
| 104 bool runFileChooser(const blink::WebFileChooserParams& params, | |
| 105 blink::WebFileChooserCompletion* completion) override; | |
| 106 blink::WebEffectiveConnectionType getEffectiveConnectionType() override; | |
| 107 | |
| 108 private: | |
| 109 TestRunner* test_runner(); | |
| 110 | |
| 111 // Borrowed pointers to other parts of Layout Tests state. | |
| 112 WebTestDelegate* delegate_; | |
| 113 WebViewTestProxyBase* web_view_test_proxy_base_; | |
| 114 WebFrameTestProxyBase* web_frame_test_proxy_base_; | |
| 115 | |
| 116 DISALLOW_COPY_AND_ASSIGN(WebFrameTestClient); | |
| 117 }; | |
| 118 | |
| 119 } // namespace test_runner | |
| 120 | |
| 121 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_ | |
| OLD | NEW |