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

Side by Side Diff: Source/bindings/core/v8/ScriptStreamerTest.cpp

Issue 669603002: Reland: Refactor Script(Loader|Runner): don't access Resources all over the place... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: test update Created 6 years, 2 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 | « Source/bindings/core/v8/ScriptStreamer.h ('k') | Source/core/dom/PendingScript.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 5
6 #include "config.h" 6 #include "config.h"
7 #include "bindings/core/v8/ScriptStreamer.h" 7 #include "bindings/core/v8/ScriptStreamer.h"
8 8
9 #include "bindings/core/v8/ScriptSourceCode.h" 9 #include "bindings/core/v8/ScriptSourceCode.h"
10 #include "bindings/core/v8/ScriptStreamerThread.h" 10 #include "bindings/core/v8/ScriptStreamerThread.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 appendData("function foo() {"); 212 appendData("function foo() {");
213 213
214 // In general, we cannot control what the background thread is doing 214 // In general, we cannot control what the background thread is doing
215 // (whether it's parsing or waiting for more data). In this test, we have 215 // (whether it's parsing or waiting for more data). In this test, we have
216 // given it so little data that it's surely waiting for more. 216 // given it so little data that it's surely waiting for more.
217 217
218 // Simulate cancelling the network load (e.g., because the user navigated 218 // Simulate cancelling the network load (e.g., because the user navigated
219 // away). 219 // away).
220 EXPECT_FALSE(client.finished()); 220 EXPECT_FALSE(client.finished());
221 pendingScript().stopWatchingForLoad(&client); 221 pendingScript().stopWatchingForLoad(&client);
222 pendingScript().releaseElementAndClear();
222 m_pendingScript = PendingScriptWrapper::create(); // This will destroy m_res ource. 223 m_pendingScript = PendingScriptWrapper::create(); // This will destroy m_res ource.
223 m_resource = 0; 224 m_resource = 0;
224 225
225 // The V8 side will complete too. This should not crash. We don't receive 226 // The V8 side will complete too. This should not crash. We don't receive
226 // any results from the streaming and the client doesn't get notified. 227 // any results from the streaming and the client doesn't get notified.
227 processTasksUntilStreamingComplete(); 228 processTasksUntilStreamingComplete();
228 EXPECT_FALSE(client.finished()); 229 EXPECT_FALSE(client.finished());
229 } 230 }
230 231
231 TEST_F(ScriptStreamingTest, SuppressingStreaming) 232 TEST_F(ScriptStreamingTest, SuppressingStreaming)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 274
274 bool errorOccurred = false; 275 bool errorOccurred = false;
275 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 276 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
276 EXPECT_FALSE(errorOccurred); 277 EXPECT_FALSE(errorOccurred);
277 EXPECT_FALSE(sourceCode.streamer()); 278 EXPECT_FALSE(sourceCode.streamer());
278 } 279 }
279 280
280 } // namespace 281 } // namespace
281 282
282 } // namespace blink 283 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.h ('k') | Source/core/dom/PendingScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698