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

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

Issue 929953002: CachedMetadata support for ServiceWorker script. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated tkent's comment Created 5 years, 10 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.cpp ('k') | Source/bindings/core/v8/V8ScriptRunner.h » ('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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // If we notice during streaming that there is a code cache, streaming 234 // If we notice during streaming that there is a code cache, streaming
235 // is suppressed (V8 doesn't parse while the script is loading), and the 235 // is suppressed (V8 doesn't parse while the script is loading), and the
236 // upper layer (ScriptResourceClient) should get a notification when the 236 // upper layer (ScriptResourceClient) should get a notification when the
237 // script is loaded. 237 // script is loaded.
238 ScriptStreamer::startStreaming(pendingScript(), m_settings.get(), m_scope.sc riptState()); 238 ScriptStreamer::startStreaming(pendingScript(), m_settings.get(), m_scope.sc riptState());
239 TestScriptResourceClient client; 239 TestScriptResourceClient client;
240 pendingScript().watchForLoad(&client); 240 pendingScript().watchForLoad(&client);
241 appendData("function foo() {"); 241 appendData("function foo() {");
242 appendPadding(); 242 appendPadding();
243 243
244 m_resource->setCachedMetadata(V8ScriptRunner::tagForCodeCache(m_resource), " X", 1, Resource::CacheLocally); 244 CachedMetadataHandler* cacheHandler = m_resource->cacheHandler();
245 EXPECT_TRUE(cacheHandler);
246 cacheHandler->setCachedMetadata(V8ScriptRunner::tagForCodeCache(cacheHandler ), "X", 1, CachedMetadataHandler::CacheLocally);
245 247
246 appendPadding(); 248 appendPadding();
247 finish(); 249 finish();
248 processTasksUntilStreamingComplete(); 250 processTasksUntilStreamingComplete();
249 EXPECT_TRUE(client.finished()); 251 EXPECT_TRUE(client.finished());
250 252
251 bool errorOccurred = false; 253 bool errorOccurred = false;
252 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 254 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
253 EXPECT_FALSE(errorOccurred); 255 EXPECT_FALSE(errorOccurred);
254 // ScriptSourceCode doesn't refer to the streamer, since we have suppressed 256 // ScriptSourceCode doesn't refer to the streamer, since we have suppressed
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 EXPECT_TRUE(sourceCode.streamer()); 385 EXPECT_TRUE(sourceCode.streamer());
384 v8::TryCatch tryCatch; 386 v8::TryCatch tryCatch;
385 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate()); 387 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate());
386 EXPECT_FALSE(script.IsEmpty()); 388 EXPECT_FALSE(script.IsEmpty());
387 EXPECT_FALSE(tryCatch.HasCaught()); 389 EXPECT_FALSE(tryCatch.HasCaught());
388 } 390 }
389 391
390 } // namespace 392 } // namespace
391 393
392 } // namespace blink 394 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.cpp ('k') | Source/bindings/core/v8/V8ScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698