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

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 vivekg'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
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 m_resource->cacheHandler()->setCachedMetadata(V8ScriptRunner::tagForCodeCach e(m_resource), "X", 1, CachedMetadataHandler::CacheLocally);
245 245
246 appendPadding(); 246 appendPadding();
247 finish(); 247 finish();
248 processTasksUntilStreamingComplete(); 248 processTasksUntilStreamingComplete();
249 EXPECT_TRUE(client.finished()); 249 EXPECT_TRUE(client.finished());
250 250
251 bool errorOccurred = false; 251 bool errorOccurred = false;
252 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 252 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
253 EXPECT_FALSE(errorOccurred); 253 EXPECT_FALSE(errorOccurred);
254 // ScriptSourceCode doesn't refer to the streamer, since we have suppressed 254 // 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()); 383 EXPECT_TRUE(sourceCode.streamer());
384 v8::TryCatch tryCatch; 384 v8::TryCatch tryCatch;
385 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate()); 385 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate());
386 EXPECT_FALSE(script.IsEmpty()); 386 EXPECT_FALSE(script.IsEmpty());
387 EXPECT_FALSE(tryCatch.HasCaught()); 387 EXPECT_FALSE(tryCatch.HasCaught());
388 } 388 }
389 389
390 } // namespace 390 } // namespace
391 391
392 } // namespace blink 392 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698