Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: components/test_runner/web_frame_test_client.h

Issue 1821923003: Extract WebFrameClient implementation out of WebTestProxyBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 AccessibilityController;
17 class EventSender;
18 class TestRunner;
19 class WebTestDelegate;
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 (|test_runner|, |delegate| and so
28 // forth) live longer than |this|.
29 WebFrameTestClient(TestRunner* test_runner,
30 WebTestDelegate* delegate,
31 AccessibilityController* accessibility_controller,
32 EventSender* event_sender);
33
34 ~WebFrameTestClient() override;
35
36 // WebFrameClient overrides needed by WebFrameTestProxy.
37 blink::WebColorChooser* createColorChooser(
38 blink::WebColorChooserClient* client,
39 const blink::WebColor& initial_color,
40 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
41 void runModalAlertDialog(const blink::WebString& message) override;
42 bool runModalConfirmDialog(const blink::WebString& message) override;
43 bool runModalPromptDialog(const blink::WebString& message,
44 const blink::WebString& default_value,
45 blink::WebString* actual_value) override;
46 bool runModalBeforeUnloadDialog(bool is_reload) override;
47 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
48 void postAccessibilityEvent(const blink::WebAXObject& object,
49 blink::WebAXEvent event) override;
50 void didChangeSelection(bool is_selection_empty) override;
51 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
52 const blink::WebPluginParams& params) override;
53 void showContextMenu(
54 const blink::WebContextMenuData& context_menu_data) override;
55 blink::WebUserMediaClient* userMediaClient() override;
56 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
57 const blink::WebString& source_name,
58 unsigned source_line,
59 const blink::WebString& stack_trace) override;
60 void loadURLExternally(const blink::WebURLRequest& request,
61 blink::WebNavigationPolicy policy,
62 const blink::WebString& suggested_name,
63 bool replaces_current_history_item) override;
64 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
65 double trigering_event_time) override;
66 void didReceiveServerRedirectForProvisionalLoad(
67 blink::WebLocalFrame* frame) override;
68 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
69 const blink::WebURLError& error,
70 blink::WebHistoryCommitType commit_type) override;
71 void didCommitProvisionalLoad(
72 blink::WebLocalFrame* frame,
73 const blink::WebHistoryItem& history_item,
74 blink::WebHistoryCommitType history_type) override;
75 void didReceiveTitle(blink::WebLocalFrame* frame,
76 const blink::WebString& title,
77 blink::WebTextDirection direction) override;
78 void didChangeIcon(blink::WebLocalFrame* frame,
79 blink::WebIconURL::Type icon_type) override;
80 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
81 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
82 void didFailLoad(blink::WebLocalFrame* frame,
83 const blink::WebURLError& error,
84 blink::WebHistoryCommitType commit_type) override;
85 void didFinishLoad(blink::WebLocalFrame* frame) override;
86 void didDetectXSS(const blink::WebURL& insecure_url,
87 bool did_block_entire_page) override;
88 void didDispatchPingLoader(const blink::WebURL& url) override;
89 void willSendRequest(blink::WebLocalFrame* frame,
90 unsigned identifier,
91 blink::WebURLRequest& request,
92 const blink::WebURLResponse& redirect_response) override;
93 void didReceiveResponse(unsigned identifier,
94 const blink::WebURLResponse& response) override;
95 void didChangeResourcePriority(unsigned identifier,
96 const blink::WebURLRequest::Priority& priority,
97 int intra_priority_value) override;
98 void didFinishResourceLoad(blink::WebLocalFrame* frame,
99 unsigned identifier) override;
100 blink::WebNavigationPolicy decidePolicyForNavigation(
101 const blink::WebFrameClient::NavigationPolicyInfo& info) override;
102 bool willCheckAndDispatchMessageEvent(
103 blink::WebLocalFrame* source_frame,
104 blink::WebFrame* target_frame,
105 blink::WebSecurityOrigin target,
106 blink::WebDOMMessageEvent event) override;
107 void checkIfAudioSinkExistsAndIsAuthorized(
108 const blink::WebString& sink_id,
109 const blink::WebSecurityOrigin& security_origin,
110 blink::WebSetSinkIdCallbacks* web_callbacks) override;
111
112 private:
113 // Borrowed pointers to other parts of Layout Tests state.
114 TestRunner* test_runner_;
115 WebTestDelegate* delegate_;
116 AccessibilityController* accessibility_controller_;
117 EventSender* event_sender_;
118
119 // Map from request identifier into resource url description. The map is used
120 // to track resource requests spanning willSendRequest, didReceiveResponse,
121 // didChangeResourcePriority, didFinishResourceLoad.
122 std::map<unsigned, std::string> resource_identifier_map_;
123
124 DISALLOW_COPY_AND_ASSIGN(WebFrameTestClient);
125 };
126
127 } // namespace test_runner
128
129 #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698