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

Side by Side Diff: third_party/WebKit/Source/web/tests/FrameTestHelpers.h

Issue 2165573003: Simplify tests by using Web*Impl types directly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "web/WebViewImpl.h" 44 #include "web/WebViewImpl.h"
45 #include <gmock/gmock.h> 45 #include <gmock/gmock.h>
46 #include <gtest/gtest.h> 46 #include <gtest/gtest.h>
47 #include <memory> 47 #include <memory>
48 #include <string> 48 #include <string>
49 49
50 namespace blink { 50 namespace blink {
51 51
52 class WebFrame; 52 class WebFrame;
53 class WebFrameWidget; 53 class WebFrameWidget;
54 class WebLocalFrame; 54 class WebLocalFrameImpl;
55 class WebRemoteFrame;
56 class WebRemoteFrameImpl; 55 class WebRemoteFrameImpl;
57 class WebSettings; 56 class WebSettings;
58 enum class WebCachePolicy; 57 enum class WebCachePolicy;
59 58
60 namespace FrameTestHelpers { 59 namespace FrameTestHelpers {
61 60
62 class TestWebFrameClient; 61 class TestWebFrameClient;
63 class TestWebWidgetClient; 62 class TestWebWidgetClient;
64 class TestWebViewClient; 63 class TestWebViewClient;
65 64
(...skipping 11 matching lines...) Expand all
77 76
78 // Pumps pending resource requests while waiting for a frame to load. Consider 77 // Pumps pending resource requests while waiting for a frame to load. Consider
79 // using one of the above helper methods whenever possible. 78 // using one of the above helper methods whenever possible.
80 void pumpPendingRequestsForFrameToLoad(WebFrame*); 79 void pumpPendingRequestsForFrameToLoad(WebFrame*);
81 80
82 WebMouseEvent createMouseEvent(WebInputEvent::Type, WebMouseEvent::Button, const IntPoint&, int modifiers); 81 WebMouseEvent createMouseEvent(WebInputEvent::Type, WebMouseEvent::Button, const IntPoint&, int modifiers);
83 82
84 // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled 83 // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled
85 // with default test values (i.e. with a default |client| or |properties| and/or 84 // with default test values (i.e. with a default |client| or |properties| and/or
86 // with a precalculated |uniqueName|). 85 // with a precalculated |uniqueName|).
87 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr, WebWidgetClient* = nullptr, WebFrame* pr eviousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerPropertie s()); 86 WebLocalFrameImpl* createLocalChild(WebRemoteFrame* parent, const WebString& nam e = WebString(), WebFrameClient* = nullptr, WebWidgetClient* = nullptr, WebFrame * previousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerPrope rties());
88 WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient*, const WebString& name = WebString()); 87 WebRemoteFrameImpl* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClie nt*, const WebString& name = WebString());
89 88
90 // Helpers for unit tests with parameterized WebSettings overrides. 89 // Helpers for unit tests with parameterized WebSettings overrides.
91 typedef void (*SettingOverrideFunction)(WebSettings*); 90 typedef void (*SettingOverrideFunction)(WebSettings*);
92 void DefaultSettingOverride(WebSettings*); 91 void DefaultSettingOverride(WebSettings*);
93 void RootLayerScrollsSettingOverride(WebSettings*); 92 void RootLayerScrollsSettingOverride(WebSettings*);
94 class SettingOverrider { 93 class SettingOverrider {
95 public: 94 public:
96 virtual void overrideSettings(WebSettings*) = 0; 95 virtual void overrideSettings(WebSettings*) = 0;
97 }; 96 };
98 97
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWidgetClient* = nullptr, void (*u pdateSettingsFunc)(WebSettings*) = 0); 189 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWidgetClient* = nullptr, void (*u pdateSettingsFunc)(WebSettings*) = 0);
191 190
192 // Same as initialize() but also performs the initial load of the url. Only 191 // Same as initialize() but also performs the initial load of the url. Only
193 // returns once the load is complete. 192 // returns once the load is complete.
194 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript = false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWi dgetClient* = nullptr, void (*updateSettingsFunc)(WebSettings*) = 0); 193 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript = false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, TestWebWi dgetClient* = nullptr, void (*updateSettingsFunc)(WebSettings*) = 0);
195 194
196 void resize(WebSize); 195 void resize(WebSize);
197 196
198 void reset(); 197 void reset();
199 198
200 WebView* webView() const { return m_webView; } 199 WebViewImpl* webView() const { return m_webView; }
201 WebViewImpl* webViewImpl() const { return m_webView; }
202 200
203 private: 201 private:
204 WebViewImpl* m_webView; 202 WebViewImpl* m_webView;
205 SettingOverrider* m_settingOverrider; 203 SettingOverrider* m_settingOverrider;
206 UseMockScrollbarSettings m_mockScrollbarSettings; 204 UseMockScrollbarSettings m_mockScrollbarSettings;
207 TestWebViewClient* m_testWebViewClient; 205 TestWebViewClient* m_testWebViewClient;
208 }; 206 };
209 207
210 // Minimal implementation of WebFrameClient needed for unit tests that load fram es. Tests that load 208 // Minimal implementation of WebFrameClient needed for unit tests that load fram es. Tests that load
211 // frames and need further specialization of WebFrameClient behavior should subc lass this. 209 // frames and need further specialization of WebFrameClient behavior should subc lass this.
(...skipping 29 matching lines...) Expand all
241 WebDOMMessageEvent) override { } 239 WebDOMMessageEvent) override { }
242 240
243 private: 241 private:
244 Persistent<WebRemoteFrameImpl> const m_frame; 242 Persistent<WebRemoteFrameImpl> const m_frame;
245 }; 243 };
246 244
247 } // namespace FrameTestHelpers 245 } // namespace FrameTestHelpers
248 } // namespace blink 246 } // namespace blink
249 247
250 #endif // FrameTestHelpers_h 248 #endif // FrameTestHelpers_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698