OLD | NEW |
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 "modules/fetch/DataConsumerTee.h" | 5 #include "modules/fetch/DataConsumerTee.h" |
6 | 6 |
7 #include "core/testing/DummyPageHolder.h" | 7 #include "core/testing/DummyPageHolder.h" |
8 #include "core/testing/NullExecutionContext.h" | 8 #include "core/testing/NullExecutionContext.h" |
9 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 9 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
10 #include "platform/CrossThreadFunctional.h" | 10 #include "platform/CrossThreadFunctional.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new
TeeCreationThread<WebDataConsumerHandle>()); | 316 std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new
TeeCreationThread<WebDataConsumerHandle>()); |
317 t->run(std::move(src), &dest1, &dest2); | 317 t->run(std::move(src), &dest1, &dest2); |
318 | 318 |
319 ASSERT_TRUE(dest1); | 319 ASSERT_TRUE(dest1); |
320 ASSERT_TRUE(dest2); | 320 ASSERT_TRUE(dest2); |
321 | 321 |
322 dest1 = nullptr; | 322 dest1 = nullptr; |
323 dest2 = nullptr; | 323 dest2 = nullptr; |
324 | 324 |
325 // Collect garbage to finalize the source reader. | 325 // Collect garbage to finalize the source reader. |
326 ThreadState::current()-> collectAllGarbage(); | 326 ThreadHeap::collectAllGarbage(); |
327 context->detached()->wait(); | 327 context->detached()->wait(); |
328 } | 328 } |
329 | 329 |
330 TEST(FetchDataConsumerTeeTest, Create) | 330 TEST(FetchDataConsumerTeeTest, Create) |
331 { | 331 { |
332 RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(); | 332 RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(); |
333 std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle
::create()); | 333 std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle
::create()); |
334 | 334 |
335 // |reader| will be adopted by |obtainFetchDataReader|. | 335 // |reader| will be adopted by |obtainFetchDataReader|. |
336 MockFetchDataConsumerReader* reader = MockFetchDataConsumerReader::create().
release(); | 336 MockFetchDataConsumerReader* reader = MockFetchDataConsumerReader::create().
release(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 std::unique_ptr<HandleReadResult> res2 = r2.wait(); | 409 std::unique_ptr<HandleReadResult> res2 = r2.wait(); |
410 | 410 |
411 EXPECT_EQ(kDone, res1->result()); | 411 EXPECT_EQ(kDone, res1->result()); |
412 EXPECT_EQ(0u, res1->data().size()); | 412 EXPECT_EQ(0u, res1->data().size()); |
413 EXPECT_EQ(kDone, res2->result()); | 413 EXPECT_EQ(kDone, res2->result()); |
414 EXPECT_EQ(0u, res2->data().size()); | 414 EXPECT_EQ(0u, res2->data().size()); |
415 } | 415 } |
416 | 416 |
417 } // namespace | 417 } // namespace |
418 } // namespace blink | 418 } // namespace blink |
OLD | NEW |