| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class ServeAsyncRequestsTask : public WebThread::Task { | 89 class ServeAsyncRequestsTask : public WebThread::Task { |
| 90 public: | 90 public: |
| 91 explicit ServeAsyncRequestsTask(TestWebFrameClient* client) | 91 explicit ServeAsyncRequestsTask(TestWebFrameClient* client) |
| 92 : m_client(client) | 92 : m_client(client) |
| 93 { | 93 { |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void run() OVERRIDE | 96 virtual void run() override |
| 97 { | 97 { |
| 98 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); | 98 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); |
| 99 if (m_client->isLoading()) | 99 if (m_client->isLoading()) |
| 100 Platform::current()->currentThread()->postTask(new ServeAsyncRequest
sTask(m_client)); | 100 Platform::current()->currentThread()->postTask(new ServeAsyncRequest
sTask(m_client)); |
| 101 else | 101 else |
| 102 Platform::current()->currentThread()->exitRunLoop(); | 102 Platform::current()->currentThread()->exitRunLoop(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 TestWebFrameClient* const m_client; | 106 TestWebFrameClient* const m_client; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 void pumpPendingRequests(WebFrame* frame) | 109 void pumpPendingRequests(WebFrame* frame) |
| 110 { | 110 { |
| 111 Platform::current()->currentThread()->postTask(new ServeAsyncRequestsTask(te
stClientForFrame(frame))); | 111 Platform::current()->currentThread()->postTask(new ServeAsyncRequestsTask(te
stClientForFrame(frame))); |
| 112 Platform::current()->currentThread()->enterRunLoop(); | 112 Platform::current()->currentThread()->enterRunLoop(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 class LoadTask : public WebThread::Task { | 115 class LoadTask : public WebThread::Task { |
| 116 public: | 116 public: |
| 117 LoadTask(WebFrame* frame, const WebURLRequest& request) | 117 LoadTask(WebFrame* frame, const WebURLRequest& request) |
| 118 : m_frame(frame) | 118 : m_frame(frame) |
| 119 , m_request(request) | 119 , m_request(request) |
| 120 { | 120 { |
| 121 } | 121 } |
| 122 | 122 |
| 123 virtual void run() OVERRIDE | 123 virtual void run() override |
| 124 { | 124 { |
| 125 m_frame->loadRequest(m_request); | 125 m_frame->loadRequest(m_request); |
| 126 } | 126 } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 WebFrame* const m_frame; | 129 WebFrame* const m_frame; |
| 130 const WebURLRequest m_request; | 130 const WebURLRequest m_request; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 class LoadHTMLStringTask : public WebThread::Task { | 133 class LoadHTMLStringTask : public WebThread::Task { |
| 134 public: | 134 public: |
| 135 LoadHTMLStringTask(WebFrame* frame, const std::string& html, const WebURL& b
aseURL) | 135 LoadHTMLStringTask(WebFrame* frame, const std::string& html, const WebURL& b
aseURL) |
| 136 : m_frame(frame) | 136 : m_frame(frame) |
| 137 , m_html(html) | 137 , m_html(html) |
| 138 , m_baseURL(baseURL) | 138 , m_baseURL(baseURL) |
| 139 { | 139 { |
| 140 } | 140 } |
| 141 | 141 |
| 142 virtual void run() OVERRIDE | 142 virtual void run() override |
| 143 { | 143 { |
| 144 m_frame->loadHTMLString(WebData(m_html.data(), m_html.size()), m_baseURL
); | 144 m_frame->loadHTMLString(WebData(m_html.data(), m_html.size()), m_baseURL
); |
| 145 } | 145 } |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 WebFrame* const m_frame; | 148 WebFrame* const m_frame; |
| 149 const std::string m_html; | 149 const std::string m_html; |
| 150 const WebURL m_baseURL; | 150 const WebURL m_baseURL; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 class LoadHistoryItemTask : public WebThread::Task { | 153 class LoadHistoryItemTask : public WebThread::Task { |
| 154 public: | 154 public: |
| 155 LoadHistoryItemTask(WebFrame* frame, const WebHistoryItem& item, WebHistoryL
oadType loadType, WebURLRequest::CachePolicy cachePolicy) | 155 LoadHistoryItemTask(WebFrame* frame, const WebHistoryItem& item, WebHistoryL
oadType loadType, WebURLRequest::CachePolicy cachePolicy) |
| 156 : m_frame(frame) | 156 : m_frame(frame) |
| 157 , m_item(item) | 157 , m_item(item) |
| 158 , m_loadType(loadType) | 158 , m_loadType(loadType) |
| 159 , m_cachePolicy(cachePolicy) | 159 , m_cachePolicy(cachePolicy) |
| 160 { | 160 { |
| 161 } | 161 } |
| 162 | 162 |
| 163 virtual void run() OVERRIDE | 163 virtual void run() override |
| 164 { | 164 { |
| 165 m_frame->loadHistoryItem(m_item, m_loadType, m_cachePolicy); | 165 m_frame->loadHistoryItem(m_item, m_loadType, m_cachePolicy); |
| 166 } | 166 } |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 WebFrame* const m_frame; | 169 WebFrame* const m_frame; |
| 170 const WebHistoryItem m_item; | 170 const WebHistoryItem m_item; |
| 171 const WebHistoryLoadType m_loadType; | 171 const WebHistoryLoadType m_loadType; |
| 172 const WebURLRequest::CachePolicy m_cachePolicy; | 172 const WebURLRequest::CachePolicy m_cachePolicy; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 class ReloadTask : public WebThread::Task { | 175 class ReloadTask : public WebThread::Task { |
| 176 public: | 176 public: |
| 177 ReloadTask(WebFrame* frame, bool ignoreCache) | 177 ReloadTask(WebFrame* frame, bool ignoreCache) |
| 178 : m_frame(frame) | 178 : m_frame(frame) |
| 179 , m_ignoreCache(ignoreCache) | 179 , m_ignoreCache(ignoreCache) |
| 180 { | 180 { |
| 181 } | 181 } |
| 182 | 182 |
| 183 virtual void run() OVERRIDE | 183 virtual void run() override |
| 184 { | 184 { |
| 185 m_frame->reload(m_ignoreCache); | 185 m_frame->reload(m_ignoreCache); |
| 186 } | 186 } |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 WebFrame* const m_frame; | 189 WebFrame* const m_frame; |
| 190 const bool m_ignoreCache; | 190 const bool m_ignoreCache; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 TestWebFrameClient* defaultWebFrameClient() | 193 TestWebFrameClient* defaultWebFrameClient() |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 void TestWebViewClient::initializeLayerTreeView() | 332 void TestWebViewClient::initializeLayerTreeView() |
| 333 { | 333 { |
| 334 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay
erTreeViewForTesting()); | 334 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay
erTreeViewForTesting()); |
| 335 ASSERT(m_layerTreeView); | 335 ASSERT(m_layerTreeView); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace FrameTestHelpers | 338 } // namespace FrameTestHelpers |
| 339 } // namespace blink | 339 } // namespace blink |
| OLD | NEW |