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

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

Issue 2536553002: Simplify: remove PendingScript::releaseElementAndClear (Closed)
Patch Set: git cl try Created 4 years 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
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 #include "bindings/core/v8/ScriptStreamer.h" 5 #include "bindings/core/v8/ScriptStreamer.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/ScriptStreamerThread.h" 8 #include "bindings/core/v8/ScriptStreamerThread.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/core/v8/V8BindingForTesting.h" 10 #include "bindings/core/v8/V8BindingForTesting.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 getPendingScript()->watchForLoad(client); 189 getPendingScript()->watchForLoad(client);
190 appendData("function foo() {"); 190 appendData("function foo() {");
191 191
192 // In general, we cannot control what the background thread is doing 192 // In general, we cannot control what the background thread is doing
193 // (whether it's parsing or waiting for more data). In this test, we have 193 // (whether it's parsing or waiting for more data). In this test, we have
194 // given it so little data that it's surely waiting for more. 194 // given it so little data that it's surely waiting for more.
195 195
196 // Simulate cancelling the network load (e.g., because the user navigated 196 // Simulate cancelling the network load (e.g., because the user navigated
197 // away). 197 // away).
198 EXPECT_FALSE(client->finished()); 198 EXPECT_FALSE(client->finished());
199 getPendingScript()->stopWatchingForLoad(); 199 getPendingScript()->dispose();
200 getPendingScript()->releaseElementAndClear();
201 m_pendingScript = nullptr; // This will destroy m_resource. 200 m_pendingScript = nullptr; // This will destroy m_resource.
202 m_resource = nullptr; 201 m_resource = nullptr;
203 202
204 // The V8 side will complete too. This should not crash. We don't receive 203 // The V8 side will complete too. This should not crash. We don't receive
205 // any results from the streaming and the client doesn't get notified. 204 // any results from the streaming and the client doesn't get notified.
206 processTasksUntilStreamingComplete(); 205 processTasksUntilStreamingComplete();
207 EXPECT_FALSE(client->finished()); 206 EXPECT_FALSE(client->finished());
208 } 207 }
209 208
210 TEST_F(ScriptStreamingTest, SuppressingStreaming) { 209 TEST_F(ScriptStreamingTest, SuppressingStreaming) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 v8::TryCatch tryCatch(scope.isolate()); 388 v8::TryCatch tryCatch(scope.isolate());
390 v8::Local<v8::Script> script; 389 v8::Local<v8::Script> script;
391 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, scope.isolate()) 390 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, scope.isolate())
392 .ToLocal(&script)); 391 .ToLocal(&script));
393 EXPECT_FALSE(tryCatch.HasCaught()); 392 EXPECT_FALSE(tryCatch.HasCaught());
394 } 393 }
395 394
396 } // namespace 395 } // namespace
397 396
398 } // namespace blink 397 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/PendingScript.h » ('j') | third_party/WebKit/Source/core/dom/ScriptLoader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698