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

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

Issue 1550193003: Disable faiilng tests under mac/asan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: durr Created 4 years, 11 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 | « no previous file | 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 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 "bindings/core/v8/ScriptStreamer.h" 6 #include "bindings/core/v8/ScriptStreamer.h"
7 7
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/ScriptStreamerThread.h" 9 #include "bindings/core/v8/ScriptStreamerThread.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void notifyFinished(Resource*) override { m_finished = true; } 136 void notifyFinished(Resource*) override { m_finished = true; }
137 String debugName() const override { return "TestScriptResourceClient"; } 137 String debugName() const override { return "TestScriptResourceClient"; }
138 138
139 bool finished() const { return m_finished; } 139 bool finished() const { return m_finished; }
140 140
141 private: 141 private:
142 bool m_finished; 142 bool m_finished;
143 }; 143 };
144 144
145 TEST_F(ScriptStreamingTest, CompilingStreamedScript) 145 #if OS(MACOSX) && defined(ADDRESS_SANITIZER)
146 // TODO(marja): Fix this test, http://crbug.com/572987
147 #define MAYBE_CompilingStreamedScript DISABLED_CompilingStreamedScript
148 #else
149 #define MAYBE_CompilingStreamedScript CompilingStreamedScript
150 #endif
151 TEST_F(ScriptStreamingTest, MAYBE_CompilingStreamedScript)
146 { 152 {
147 // Test that we can successfully compile a streamed script. 153 // Test that we can successfully compile a streamed script.
148 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); 154 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
149 TestScriptResourceClient client; 155 TestScriptResourceClient client;
150 pendingScript().watchForLoad(&client); 156 pendingScript().watchForLoad(&client);
151 157
152 appendData("function foo() {"); 158 appendData("function foo() {");
153 appendPadding(); 159 appendPadding();
154 appendData("return 5; }"); 160 appendData("return 5; }");
155 appendPadding(); 161 appendPadding();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // The finished notification should arrive immediately and not be cycled 304 // The finished notification should arrive immediately and not be cycled
299 // through a background thread. 305 // through a background thread.
300 EXPECT_TRUE(client.finished()); 306 EXPECT_TRUE(client.finished());
301 307
302 bool errorOccurred = false; 308 bool errorOccurred = false;
303 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 309 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
304 EXPECT_FALSE(errorOccurred); 310 EXPECT_FALSE(errorOccurred);
305 EXPECT_FALSE(sourceCode.streamer()); 311 EXPECT_FALSE(sourceCode.streamer());
306 } 312 }
307 313
308 TEST_F(ScriptStreamingTest, ScriptsWithSmallFirstChunk) 314 #if OS(MACOSX) && defined(ADDRESS_SANITIZER)
315 // TODO(marja): Fix this test, http://crbug.com/572987
316 #define MAYBE_ScriptsWithSmallFirstChunk DISABLED_ScriptsWithSmallFirstChunk
317 #else
318 #define MAYBE_ScriptsWithSmallFirstChunk ScriptsWithSmallFirstChunk
319 #endif
320 TEST_F(ScriptStreamingTest, MAYBE_ScriptsWithSmallFirstChunk)
309 { 321 {
310 // If a script is long enough, if should be streamed, even if the first data 322 // If a script is long enough, if should be streamed, even if the first data
311 // chunk is small. 323 // chunk is small.
312 ScriptStreamer::setSmallScriptThresholdForTesting(100); 324 ScriptStreamer::setSmallScriptThresholdForTesting(100);
313 325
314 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); 326 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
315 TestScriptResourceClient client; 327 TestScriptResourceClient client;
316 pendingScript().watchForLoad(&client); 328 pendingScript().watchForLoad(&client);
317 329
318 // This is the first data chunk which is small. 330 // This is the first data chunk which is small.
319 appendData("function foo() { }"); 331 appendData("function foo() { }");
320 appendPadding(); 332 appendPadding();
321 appendPadding(); 333 appendPadding();
322 appendPadding(); 334 appendPadding();
323 335
324 finish(); 336 finish();
325 337
326 processTasksUntilStreamingComplete(); 338 processTasksUntilStreamingComplete();
327 EXPECT_TRUE(client.finished()); 339 EXPECT_TRUE(client.finished());
328 bool errorOccurred = false; 340 bool errorOccurred = false;
329 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 341 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
330 EXPECT_FALSE(errorOccurred); 342 EXPECT_FALSE(errorOccurred);
331 EXPECT_TRUE(sourceCode.streamer()); 343 EXPECT_TRUE(sourceCode.streamer());
332 v8::TryCatch tryCatch(isolate()); 344 v8::TryCatch tryCatch(isolate());
333 v8::Local<v8::Script> script; 345 v8::Local<v8::Script> script;
334 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript)); 346 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript));
335 EXPECT_FALSE(tryCatch.HasCaught()); 347 EXPECT_FALSE(tryCatch.HasCaught());
336 } 348 }
337 349
338 TEST_F(ScriptStreamingTest, EncodingChanges) 350 #if OS(MACOSX) && defined(ADDRESS_SANITIZER)
351 // TODO(marja): Fix this test, http://crbug.com/572987
352 #define MAYBE_EncodingChanges DISABLED_EncodingChanges
353 #else
354 #define MAYBE_EncodingChanges EncodingChanges
355 #endif
356 TEST_F(ScriptStreamingTest, MAYBE_EncodingChanges)
339 { 357 {
340 // It's possible that the encoding of the Resource changes after we start 358 // It's possible that the encoding of the Resource changes after we start
341 // loading it. 359 // loading it.
342 m_resource->setEncoding("windows-1252"); 360 m_resource->setEncoding("windows-1252");
343 361
344 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); 362 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
345 TestScriptResourceClient client; 363 TestScriptResourceClient client;
346 pendingScript().watchForLoad(&client); 364 pendingScript().watchForLoad(&client);
347 365
348 m_resource->setEncoding("UTF-8"); 366 m_resource->setEncoding("UTF-8");
349 // \xec\x92\x81 are the raw bytes for \uc481. 367 // \xec\x92\x81 are the raw bytes for \uc481.
350 appendData("function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92 \x81r; } foo();"); 368 appendData("function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92 \x81r; } foo();");
351 369
352 finish(); 370 finish();
353 371
354 processTasksUntilStreamingComplete(); 372 processTasksUntilStreamingComplete();
355 EXPECT_TRUE(client.finished()); 373 EXPECT_TRUE(client.finished());
356 bool errorOccurred = false; 374 bool errorOccurred = false;
357 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 375 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
358 EXPECT_FALSE(errorOccurred); 376 EXPECT_FALSE(errorOccurred);
359 EXPECT_TRUE(sourceCode.streamer()); 377 EXPECT_TRUE(sourceCode.streamer());
360 v8::TryCatch tryCatch(isolate()); 378 v8::TryCatch tryCatch(isolate());
361 v8::Local<v8::Script> script; 379 v8::Local<v8::Script> script;
362 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript)); 380 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript));
363 EXPECT_FALSE(tryCatch.HasCaught()); 381 EXPECT_FALSE(tryCatch.HasCaught());
364 } 382 }
365 383
366 384
367 TEST_F(ScriptStreamingTest, EncodingFromBOM) 385 #if OS(MACOSX) && defined(ADDRESS_SANITIZER)
386 // TODO(marja): Fix this test, http://crbug.com/572987
387 #define MAYBE_EncodingFromBOM DISABLED_EncodingFromBOM
388 #else
389 #define MAYBE_EncodingFromBOM EncodingFromBOM
390 #endif
391 TEST_F(ScriptStreamingTest, MAYBE_EncodingFromBOM)
368 { 392 {
369 // Byte order marks should be removed before giving the data to V8. They 393 // Byte order marks should be removed before giving the data to V8. They
370 // will also affect encoding detection. 394 // will also affect encoding detection.
371 m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpos e. 395 m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpos e.
372 396
373 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner); 397 ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocki ng, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
374 TestScriptResourceClient client; 398 TestScriptResourceClient client;
375 pendingScript().watchForLoad(&client); 399 pendingScript().watchForLoad(&client);
376 400
377 // \xef\xbb\xbf is the UTF-8 byte order mark. \xec\x92\x81 are the raw bytes 401 // \xef\xbb\xbf is the UTF-8 byte order mark. \xec\x92\x81 are the raw bytes
378 // for \uc481. 402 // for \uc481.
379 appendData("\xef\xbb\xbf function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92\x81r; } foo();"); 403 appendData("\xef\xbb\xbf function foo() { var foob\xec\x92\x81r = 13; return foob\xec\x92\x81r; } foo();");
380 404
381 finish(); 405 finish();
382 processTasksUntilStreamingComplete(); 406 processTasksUntilStreamingComplete();
383 EXPECT_TRUE(client.finished()); 407 EXPECT_TRUE(client.finished());
384 bool errorOccurred = false; 408 bool errorOccurred = false;
385 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d); 409 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre d);
386 EXPECT_FALSE(errorOccurred); 410 EXPECT_FALSE(errorOccurred);
387 EXPECT_TRUE(sourceCode.streamer()); 411 EXPECT_TRUE(sourceCode.streamer());
388 v8::TryCatch tryCatch(isolate()); 412 v8::TryCatch tryCatch(isolate());
389 v8::Local<v8::Script> script; 413 v8::Local<v8::Script> script;
390 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript)); 414 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript));
391 EXPECT_FALSE(tryCatch.HasCaught()); 415 EXPECT_FALSE(tryCatch.HasCaught());
392 } 416 }
393 417
394 } // namespace 418 } // namespace
395 419
396 } // namespace blink 420 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698