OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 public: | 76 public: |
77 explicit ServeAsyncRequestsTask(TestWebFrameClient* client) | 77 explicit ServeAsyncRequestsTask(TestWebFrameClient* client) |
78 : m_client(client) | 78 : m_client(client) |
79 { | 79 { |
80 } | 80 } |
81 | 81 |
82 void run() override | 82 void run() override |
83 { | 83 { |
84 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); | 84 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); |
85 if (m_client->isLoading()) | 85 if (m_client->isLoading()) |
86 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HE
RE, new ServeAsyncRequestsTask(m_client)); | 86 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_F
ROM_HERE, new ServeAsyncRequestsTask(m_client)); |
87 else | 87 else |
88 Platform::current()->unitTestSupport()->exitRunLoop(); | 88 Platform::current()->unitTestSupport()->exitRunLoop(); |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 TestWebFrameClient* const m_client; | 92 TestWebFrameClient* const m_client; |
93 }; | 93 }; |
94 | 94 |
95 void pumpPendingRequests(WebFrame* frame) | 95 void pumpPendingRequests(WebFrame* frame) |
96 { | 96 { |
97 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
ServeAsyncRequestsTask(testClientForFrame(frame))); | 97 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new ServeAsyncRequestsTask(testClientForFrame(frame))); |
98 Platform::current()->unitTestSupport()->enterRunLoop(); | 98 Platform::current()->unitTestSupport()->enterRunLoop(); |
99 } | 99 } |
100 | 100 |
101 class LoadTask : public WebTaskRunner::Task { | 101 class LoadTask : public WebTaskRunner::Task { |
102 public: | 102 public: |
103 LoadTask(WebFrame* frame, const WebURLRequest& request) | 103 LoadTask(WebFrame* frame, const WebURLRequest& request) |
104 : m_frame(frame) | 104 : m_frame(frame) |
105 , m_request(request) | 105 , m_request(request) |
106 { | 106 { |
107 } | 107 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 } // namespace | 191 } // namespace |
192 | 192 |
193 void loadFrame(WebFrame* frame, const std::string& url) | 193 void loadFrame(WebFrame* frame, const std::string& url) |
194 { | 194 { |
195 WebURLRequest urlRequest; | 195 WebURLRequest urlRequest; |
196 urlRequest.initialize(); | 196 urlRequest.initialize(); |
197 urlRequest.setURL(URLTestHelpers::toKURL(url)); | 197 urlRequest.setURL(URLTestHelpers::toKURL(url)); |
198 | 198 |
199 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
LoadTask(frame, urlRequest)); | 199 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new LoadTask(frame, urlRequest)); |
200 pumpPendingRequests(frame); | 200 pumpPendingRequests(frame); |
201 } | 201 } |
202 | 202 |
203 void loadHTMLString(WebFrame* frame, const std::string& html, const WebURL& base
URL) | 203 void loadHTMLString(WebFrame* frame, const std::string& html, const WebURL& base
URL) |
204 { | 204 { |
205 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
LoadHTMLStringTask(frame, html, baseURL)); | 205 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new LoadHTMLStringTask(frame, html, baseURL)); |
206 pumpPendingRequests(frame); | 206 pumpPendingRequests(frame); |
207 } | 207 } |
208 | 208 |
209 void loadHistoryItem(WebFrame* frame, const WebHistoryItem& item, WebHistoryLoad
Type loadType, WebURLRequest::CachePolicy cachePolicy) | 209 void loadHistoryItem(WebFrame* frame, const WebHistoryItem& item, WebHistoryLoad
Type loadType, WebURLRequest::CachePolicy cachePolicy) |
210 { | 210 { |
211 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
LoadHistoryItemTask(frame, item, loadType, cachePolicy)); | 211 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new LoadHistoryItemTask(frame, item, loadType, cachePolicy)); |
212 pumpPendingRequests(frame); | 212 pumpPendingRequests(frame); |
213 } | 213 } |
214 | 214 |
215 void reloadFrame(WebFrame* frame) | 215 void reloadFrame(WebFrame* frame) |
216 { | 216 { |
217 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
ReloadTask(frame, false)); | 217 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new ReloadTask(frame, false)); |
218 pumpPendingRequests(frame); | 218 pumpPendingRequests(frame); |
219 } | 219 } |
220 | 220 |
221 void reloadFrameIgnoringCache(WebFrame* frame) | 221 void reloadFrameIgnoringCache(WebFrame* frame) |
222 { | 222 { |
223 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new
ReloadTask(frame, true)); | 223 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE
, new ReloadTask(frame, true)); |
224 pumpPendingRequests(frame); | 224 pumpPendingRequests(frame); |
225 } | 225 } |
226 | 226 |
227 void pumpPendingRequestsDoNotUse(WebFrame* frame) | 227 void pumpPendingRequestsDoNotUse(WebFrame* frame) |
228 { | 228 { |
229 pumpPendingRequests(frame); | 229 pumpPendingRequests(frame); |
230 } | 230 } |
231 | 231 |
232 WebViewHelper::WebViewHelper(SettingOverrider* settingOverrider) | 232 WebViewHelper::WebViewHelper(SettingOverrider* settingOverrider) |
233 : m_webView(0) | 233 : m_webView(0) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 | 340 |
341 void TestWebViewClient::initializeLayerTreeView() | 341 void TestWebViewClient::initializeLayerTreeView() |
342 { | 342 { |
343 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay
erTreeViewForTesting()); | 343 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay
erTreeViewForTesting()); |
344 ASSERT(m_layerTreeView); | 344 ASSERT(m_layerTreeView); |
345 } | 345 } |
346 | 346 |
347 } // namespace FrameTestHelpers | 347 } // namespace FrameTestHelpers |
348 } // namespace blink | 348 } // namespace blink |
OLD | NEW |