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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 bufferp[i]); | 78 bufferp[i]); |
79 if (static_cast<int>((i + consuming_seed_key_ - 1) % | 79 if (static_cast<int>((i + consuming_seed_key_ - 1) % |
80 (1 << sizeof(char))) != bufferp[i]) { | 80 (1 << sizeof(char))) != bufferp[i]) { |
81 return false; | 81 return false; |
82 } | 82 } |
83 } | 83 } |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 protected: | 87 protected: |
88 MessageLoop message_loop_; | 88 base::MessageLoop message_loop_; |
89 | 89 |
90 private: | 90 private: |
91 int producing_seed_key_; | 91 int producing_seed_key_; |
92 int consuming_seed_key_; | 92 int consuming_seed_key_; |
93 std::deque<char*> pointer_queue_; | 93 std::deque<char*> pointer_queue_; |
94 std::deque<size_t> length_queue_; | 94 std::deque<size_t> length_queue_; |
95 }; | 95 }; |
96 | 96 |
97 ByteStreamTest::ByteStreamTest() | 97 ByteStreamTest::ByteStreamTest() |
98 : producing_seed_key_(0), | 98 : producing_seed_key_(0), |
(...skipping 399 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 |