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

Side by Side Diff: third_party/WebKit/Source/web/tests/sim/SimRequest.cpp

Issue 1833303002: [Not committed] Make image load completion async and remove EventSender from ImageLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_asyncImageLoadEvent_1
Patch Set: Rebase. Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/tests/sim/SimRequest.h" 5 #include "web/tests/sim/SimRequest.h"
6 6
7 #include "platform/testing/UnitTestHelpers.h"
7 #include "platform/weborigin/KURL.h" 8 #include "platform/weborigin/KURL.h"
8 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
9 #include "public/platform/WebURLLoaderClient.h" 10 #include "public/platform/WebURLLoaderClient.h"
10 #include "public/platform/WebUnitTestSupport.h" 11 #include "public/platform/WebUnitTestSupport.h"
11 #include "web/tests/sim/SimNetwork.h" 12 #include "web/tests/sim/SimNetwork.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 SimRequest::SimRequest(String url, String mimeType) 16 SimRequest::SimRequest(String url, String mimeType)
16 : m_url(url) 17 : m_url(url)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void SimRequest::finish() 64 void SimRequest::finish()
64 { 65 {
65 DCHECK(m_isReady); 66 DCHECK(m_isReady);
66 if (m_error.reason) { 67 if (m_error.reason) {
67 m_client->didFail(m_loader, m_error); 68 m_client->didFail(m_loader, m_error);
68 } else { 69 } else {
69 // TODO(esprehn): Is claiming a request time of 0 okay for tests? 70 // TODO(esprehn): Is claiming a request time of 0 okay for tests?
70 m_client->didFinishLoading(m_loader, 0, m_totalEncodedDataLength); 71 m_client->didFinishLoading(m_loader, 0, m_totalEncodedDataLength);
71 } 72 }
72 reset(); 73 reset();
74
75 // Pump the message loop to process the load event.
76 testing::runPendingTasks();
73 } 77 }
74 78
75 void SimRequest::complete(const String& data) 79 void SimRequest::complete(const String& data)
76 { 80 {
77 start(); 81 start();
78 if (!data.isEmpty()) 82 if (!data.isEmpty())
79 write(data); 83 write(data);
80 finish(); 84 finish();
81 } 85 }
82 86
83 void SimRequest::reset() 87 void SimRequest::reset()
84 { 88 {
85 m_isReady = false; 89 m_isReady = false;
86 m_client = nullptr; 90 m_client = nullptr;
87 m_loader = nullptr; 91 m_loader = nullptr;
88 SimNetwork::current().removeRequest(*this); 92 SimNetwork::current().removeRequest(*this);
89 } 93 }
90 94
91 } // namespace blink 95 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698