OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/byte_stream.h" | 5 #include "content/browser/byte_stream.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/test/test_simple_task_runner.h" | 13 #include "base/test/test_simple_task_runner.h" |
14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 namespace { | 18 namespace { |
19 | 19 |
20 void CountCallbacks(int* counter) { | 20 void CountCallbacks(int* counter) { |
21 ++*counter; | 21 ++*counter; |
22 } | 22 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 byte_stream_output->RegisterCallback( | 498 byte_stream_output->RegisterCallback( |
499 base::Bind(CountCallbacks, &num_callbacks)); | 499 base::Bind(CountCallbacks, &num_callbacks)); |
500 | 500 |
501 // Immediately close the stream. | 501 // Immediately close the stream. |
502 byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NONE); | 502 byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NONE); |
503 task_runner->RunUntilIdle(); | 503 task_runner->RunUntilIdle(); |
504 EXPECT_EQ(1, num_callbacks); | 504 EXPECT_EQ(1, num_callbacks); |
505 } | 505 } |
506 | 506 |
507 } // namespace content | 507 } // namespace content |
OLD | NEW |