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

Side by Side Diff: third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp

Issue 1908213004: [Streams] Remove SetReadableStreamDisturbed from ReadableStream.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/streams/ReadableStreamOperations.h" 5 #include "core/streams/ReadableStreamOperations.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptFunction.h" 8 #include "bindings/core/v8/ScriptFunction.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_TRUE(underlyingSource->hasPendingActivity()); 352 EXPECT_TRUE(underlyingSource->hasPendingActivity());
353 evalWithPrintingError("reader.releaseLock();"); 353 evalWithPrintingError("reader.releaseLock();");
354 EXPECT_FALSE(underlyingSource->hasPendingActivity()); 354 EXPECT_FALSE(underlyingSource->hasPendingActivity());
355 evalWithPrintingError("reader = stream.getReader();"); 355 evalWithPrintingError("reader = stream.getReader();");
356 EXPECT_TRUE(underlyingSource->hasPendingActivity()); 356 EXPECT_TRUE(underlyingSource->hasPendingActivity());
357 underlyingSource->enqueue(ScriptValue(getScriptState(), v8::Undefined(getScr iptState()->isolate()))); 357 underlyingSource->enqueue(ScriptValue(getScriptState(), v8::Undefined(getScr iptState()->isolate())));
358 underlyingSource->close(); 358 underlyingSource->close();
359 EXPECT_FALSE(underlyingSource->hasPendingActivity()); 359 EXPECT_FALSE(underlyingSource->hasPendingActivity());
360 } 360 }
361 361
362 TEST_F(ReadableStreamOperationsTest, SetDisturbed)
363 {
364 ScriptValue stream = evalWithPrintingError("new ReadableStream()");
365 ASSERT_FALSE(stream.isEmpty());
366
367 EXPECT_FALSE(ReadableStreamOperations::isDisturbed(getScriptState(), stream) );
368 ReadableStreamOperations::setDisturbed(getScriptState(), stream);
369 EXPECT_TRUE(ReadableStreamOperations::isDisturbed(getScriptState(), stream)) ;
370 }
371
372 TEST_F(ReadableStreamOperationsTest, IsReadable) 362 TEST_F(ReadableStreamOperationsTest, IsReadable)
373 { 363 {
374 ScriptValue readable = evalWithPrintingError("new ReadableStream()"); 364 ScriptValue readable = evalWithPrintingError("new ReadableStream()");
375 ScriptValue closed = evalWithPrintingError("new ReadableStream({start: c => c.close()})"); 365 ScriptValue closed = evalWithPrintingError("new ReadableStream({start: c => c.close()})");
376 ScriptValue errored = evalWithPrintingError("new ReadableStream({start: c => c.error()})"); 366 ScriptValue errored = evalWithPrintingError("new ReadableStream({start: c => c.error()})");
377 ASSERT_FALSE(readable.isEmpty()); 367 ASSERT_FALSE(readable.isEmpty());
378 ASSERT_FALSE(closed.isEmpty()); 368 ASSERT_FALSE(closed.isEmpty());
379 ASSERT_FALSE(errored.isEmpty()); 369 ASSERT_FALSE(errored.isEmpty());
380 370
381 EXPECT_TRUE(ReadableStreamOperations::isReadable(getScriptState(), readable) ); 371 EXPECT_TRUE(ReadableStreamOperations::isReadable(getScriptState(), readable) );
(...skipping 26 matching lines...) Expand all
408 398
409 EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), readable) ); 399 EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), readable) );
410 EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), closed)); 400 EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), closed));
411 EXPECT_TRUE(ReadableStreamOperations::isErrored(getScriptState(), errored)); 401 EXPECT_TRUE(ReadableStreamOperations::isErrored(getScriptState(), errored));
412 } 402 }
413 403
414 } // namespace 404 } // namespace
415 405
416 } // namespace blink 406 } // namespace blink
417 407
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698