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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return static_cast<TestWebFrameClient*>(toWebLocalFrameImpl(frame)->client()
); | 72 return static_cast<TestWebFrameClient*>(toWebLocalFrameImpl(frame)->client()
); |
73 } | 73 } |
74 | 74 |
75 class ServeAsyncRequestsTask : public WebThread::Task { | 75 class ServeAsyncRequestsTask : public WebThread::Task { |
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 virtual 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()->postTask(FROM_HERE, new ServeA
syncRequestsTask(m_client)); | 86 Platform::current()->currentThread()->postTask(FROM_HERE, new ServeA
syncRequestsTask(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()->postTask(FROM_HERE, new ServeAsyncRequ
estsTask(testClientForFrame(frame))); | 97 Platform::current()->currentThread()->postTask(FROM_HERE, new ServeAsyncRequ
estsTask(testClientForFrame(frame))); |
98 Platform::current()->unitTestSupport()->enterRunLoop(); | 98 Platform::current()->unitTestSupport()->enterRunLoop(); |
99 } | 99 } |
100 | 100 |
101 class LoadTask : public WebThread::Task { | 101 class LoadTask : public WebThread::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 } |
108 | 108 |
109 virtual void run() override | 109 void run() override |
110 { | 110 { |
111 m_frame->loadRequest(m_request); | 111 m_frame->loadRequest(m_request); |
112 } | 112 } |
113 | 113 |
114 private: | 114 private: |
115 WebFrame* const m_frame; | 115 WebFrame* const m_frame; |
116 const WebURLRequest m_request; | 116 const WebURLRequest m_request; |
117 }; | 117 }; |
118 | 118 |
119 class LoadHTMLStringTask : public WebThread::Task { | 119 class LoadHTMLStringTask : public WebThread::Task { |
120 public: | 120 public: |
121 LoadHTMLStringTask(WebFrame* frame, const std::string& html, const WebURL& b
aseURL) | 121 LoadHTMLStringTask(WebFrame* frame, const std::string& html, const WebURL& b
aseURL) |
122 : m_frame(frame) | 122 : m_frame(frame) |
123 , m_html(html) | 123 , m_html(html) |
124 , m_baseURL(baseURL) | 124 , m_baseURL(baseURL) |
125 { | 125 { |
126 } | 126 } |
127 | 127 |
128 virtual void run() override | 128 void run() override |
129 { | 129 { |
130 m_frame->loadHTMLString(WebData(m_html.data(), m_html.size()), m_baseURL
); | 130 m_frame->loadHTMLString(WebData(m_html.data(), m_html.size()), m_baseURL
); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 WebFrame* const m_frame; | 134 WebFrame* const m_frame; |
135 const std::string m_html; | 135 const std::string m_html; |
136 const WebURL m_baseURL; | 136 const WebURL m_baseURL; |
137 }; | 137 }; |
138 | 138 |
139 class LoadHistoryItemTask : public WebThread::Task { | 139 class LoadHistoryItemTask : public WebThread::Task { |
140 public: | 140 public: |
141 LoadHistoryItemTask(WebFrame* frame, const WebHistoryItem& item, WebHistoryL
oadType loadType, WebURLRequest::CachePolicy cachePolicy) | 141 LoadHistoryItemTask(WebFrame* frame, const WebHistoryItem& item, WebHistoryL
oadType loadType, WebURLRequest::CachePolicy cachePolicy) |
142 : m_frame(frame) | 142 : m_frame(frame) |
143 , m_item(item) | 143 , m_item(item) |
144 , m_loadType(loadType) | 144 , m_loadType(loadType) |
145 , m_cachePolicy(cachePolicy) | 145 , m_cachePolicy(cachePolicy) |
146 { | 146 { |
147 } | 147 } |
148 | 148 |
149 virtual void run() override | 149 void run() override |
150 { | 150 { |
151 m_frame->loadHistoryItem(m_item, m_loadType, m_cachePolicy); | 151 m_frame->loadHistoryItem(m_item, m_loadType, m_cachePolicy); |
152 } | 152 } |
153 | 153 |
154 private: | 154 private: |
155 WebFrame* const m_frame; | 155 WebFrame* const m_frame; |
156 const WebHistoryItem m_item; | 156 const WebHistoryItem m_item; |
157 const WebHistoryLoadType m_loadType; | 157 const WebHistoryLoadType m_loadType; |
158 const WebURLRequest::CachePolicy m_cachePolicy; | 158 const WebURLRequest::CachePolicy m_cachePolicy; |
159 }; | 159 }; |
160 | 160 |
161 class ReloadTask : public WebThread::Task { | 161 class ReloadTask : public WebThread::Task { |
162 public: | 162 public: |
163 ReloadTask(WebFrame* frame, bool ignoreCache) | 163 ReloadTask(WebFrame* frame, bool ignoreCache) |
164 : m_frame(frame) | 164 : m_frame(frame) |
165 , m_ignoreCache(ignoreCache) | 165 , m_ignoreCache(ignoreCache) |
166 { | 166 { |
167 } | 167 } |
168 | 168 |
169 virtual void run() override | 169 void run() override |
170 { | 170 { |
171 m_frame->reload(m_ignoreCache); | 171 m_frame->reload(m_ignoreCache); |
172 } | 172 } |
173 | 173 |
174 private: | 174 private: |
175 WebFrame* const m_frame; | 175 WebFrame* const m_frame; |
176 const bool m_ignoreCache; | 176 const bool m_ignoreCache; |
177 }; | 177 }; |
178 | 178 |
179 TestWebFrameClient* defaultWebFrameClient() | 179 TestWebFrameClient* defaultWebFrameClient() |
(...skipping 159 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 |