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

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

Issue 1635873003: Replicating WebFrame::uniqueName across renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump-render-tree3
Patch Set: Rebasing... Created 4 years, 10 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef FrameTestHelpers_h 31 #ifndef FrameTestHelpers_h
32 #define FrameTestHelpers_h 32 #define FrameTestHelpers_h
33 33
34 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
35 #include "platform/RuntimeEnabledFeatures.h" 35 #include "platform/RuntimeEnabledFeatures.h"
36 #include "platform/scroll/ScrollbarTheme.h" 36 #include "platform/scroll/ScrollbarTheme.h"
37 #include "public/platform/WebString.h"
37 #include "public/platform/WebURLRequest.h" 38 #include "public/platform/WebURLRequest.h"
38 #include "public/web/WebFrameClient.h" 39 #include "public/web/WebFrameClient.h"
40 #include "public/web/WebFrameOwnerProperties.h"
39 #include "public/web/WebHistoryItem.h" 41 #include "public/web/WebHistoryItem.h"
40 #include "public/web/WebRemoteFrameClient.h" 42 #include "public/web/WebRemoteFrameClient.h"
41 #include "public/web/WebViewClient.h" 43 #include "public/web/WebViewClient.h"
42 #include "web/WebViewImpl.h" 44 #include "web/WebViewImpl.h"
43 #include "wtf/PassOwnPtr.h" 45 #include "wtf/PassOwnPtr.h"
44 #include <gmock/gmock.h> 46 #include <gmock/gmock.h>
45 #include <gtest/gtest.h> 47 #include <gtest/gtest.h>
46 #include <string> 48 #include <string>
47 49
48 namespace blink { 50 namespace blink {
49 51
52 class WebFrame;
50 class WebFrameWidget; 53 class WebFrameWidget;
54 class WebLocalFrame;
55 class WebRemoteFrame;
51 class WebRemoteFrameImpl; 56 class WebRemoteFrameImpl;
52 57
53 namespace FrameTestHelpers { 58 namespace FrameTestHelpers {
54 59
55 class TestWebFrameClient; 60 class TestWebFrameClient;
56 61
57 // Loads a url into the specified WebFrame for testing purposes. Pumps any 62 // Loads a url into the specified WebFrame for testing purposes. Pumps any
58 // pending resource requests, as well as waiting for the threaded parser to 63 // pending resource requests, as well as waiting for the threaded parser to
59 // finish, before returning. 64 // finish, before returning.
60 void loadFrame(WebFrame*, const std::string& url); 65 void loadFrame(WebFrame*, const std::string& url);
61 // Same as above, but for WebFrame::loadHTMLString(). 66 // Same as above, but for WebFrame::loadHTMLString().
62 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL); 67 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL);
63 // Same as above, but for WebFrame::loadHistoryItem(). 68 // Same as above, but for WebFrame::loadHistoryItem().
64 void loadHistoryItem(WebFrame*, const WebHistoryItem&, WebHistoryLoadType, WebUR LRequest::CachePolicy); 69 void loadHistoryItem(WebFrame*, const WebHistoryItem&, WebHistoryLoadType, WebUR LRequest::CachePolicy);
65 // Same as above, but for WebFrame::reload(). 70 // Same as above, but for WebFrame::reload().
66 void reloadFrame(WebFrame*); 71 void reloadFrame(WebFrame*);
67 void reloadFrameIgnoringCache(WebFrame*); 72 void reloadFrameIgnoringCache(WebFrame*);
68 73
69 // Pumps pending resource requests while waiting for a frame to load. Don't use 74 // Pumps pending resource requests while waiting for a frame to load. Don't use
70 // this. Use one of the above helpers. 75 // this. Use one of the above helpers.
71 void pumpPendingRequestsDoNotUse(WebFrame*); 76 void pumpPendingRequestsDoNotUse(WebFrame*);
72 77
78 // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled
79 // with default test values (i.e. with a default |client| or |properties| and/or
80 // with a precalculated |uniqueName|).
81 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString::fromUTF8("frameName"), WebFrameClient* = nullptr, WebFrame* previousS ibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties());
82
73 class SettingOverrider { 83 class SettingOverrider {
74 public: 84 public:
75 virtual void overrideSettings(WebSettings*) = 0; 85 virtual void overrideSettings(WebSettings*) = 0;
76 }; 86 };
77 87
78 // Forces to use mocked overlay scrollbars instead of the default native theme s crollbars to avoid 88 // Forces to use mocked overlay scrollbars instead of the default native theme s crollbars to avoid
79 // crash in Chromium code when it tries to load UI resources that are not availa ble when running 89 // crash in Chromium code when it tries to load UI resources that are not availa ble when running
80 // blink unit tests, and to ensure consistent layout regardless of differences b etween scrollbar themes. 90 // blink unit tests, and to ensure consistent layout regardless of differences b etween scrollbar themes.
81 // WebViewHelper includes this, so this is only needed if a test doesn't use Web ViewHelper or the test 91 // WebViewHelper includes this, so this is only needed if a test doesn't use Web ViewHelper or the test
82 // needs a bigger scope of mock scrollbar settings than the scope of WebViewHelp er. 92 // needs a bigger scope of mock scrollbar settings than the scope of WebViewHelp er.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 UseMockScrollbarSettings m_mockScrollbarSettings; 158 UseMockScrollbarSettings m_mockScrollbarSettings;
149 TestWebViewClient* m_testWebViewClient; 159 TestWebViewClient* m_testWebViewClient;
150 }; 160 };
151 161
152 // Minimal implementation of WebFrameClient needed for unit tests that load fram es. Tests that load 162 // Minimal implementation of WebFrameClient needed for unit tests that load fram es. Tests that load
153 // frames and need further specialization of WebFrameClient behavior should subc lass this. 163 // frames and need further specialization of WebFrameClient behavior should subc lass this.
154 class TestWebFrameClient : public WebFrameClient { 164 class TestWebFrameClient : public WebFrameClient {
155 public: 165 public:
156 TestWebFrameClient(); 166 TestWebFrameClient();
157 167
158 WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType, const We bString& frameName, WebSandboxFlags, const WebFrameOwnerProperties&) override; 168 WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType, const We bString& name, const WebString& uniqueName, WebSandboxFlags, const WebFrameOwner Properties&) override;
159 void frameDetached(WebFrame*, DetachType) override; 169 void frameDetached(WebFrame*, DetachType) override;
160 void didStartLoading(bool) override; 170 void didStartLoading(bool) override;
161 void didStopLoading() override; 171 void didStopLoading() override;
162 172
163 bool isLoading() { return m_loadsInProgress > 0; } 173 bool isLoading() { return m_loadsInProgress > 0; }
164 void waitForLoadToComplete(); 174 void waitForLoadToComplete();
165 175
166 private: 176 private:
167 int m_loadsInProgress; 177 int m_loadsInProgress;
168 }; 178 };
(...skipping 15 matching lines...) Expand all
184 WebDOMMessageEvent) override { } 194 WebDOMMessageEvent) override { }
185 195
186 private: 196 private:
187 RawPtrWillBePersistent<WebRemoteFrameImpl> const m_frame; 197 RawPtrWillBePersistent<WebRemoteFrameImpl> const m_frame;
188 }; 198 };
189 199
190 } // namespace FrameTestHelpers 200 } // namespace FrameTestHelpers
191 } // namespace blink 201 } // namespace blink
192 202
193 #endif // FrameTestHelpers_h 203 #endif // FrameTestHelpers_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp ('k') | third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698