| 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 "android_webview/browser/net/input_stream_reader.h" |
| 6 |
| 5 #include "android_webview/browser/input_stream.h" | 7 #include "android_webview/browser/input_stream.h" |
| 6 #include "android_webview/browser/net/input_stream_reader.h" | |
| 7 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 8 #include "base/callback.h" | 9 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/http/http_byte_range.h" | 12 #include "net/http/http_byte_range.h" |
| 13 | |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 using android_webview::InputStream; | 16 using android_webview::InputStream; |
| 18 using android_webview::InputStreamReader; | 17 using android_webview::InputStreamReader; |
| 19 using testing::DoAll; | 18 using testing::DoAll; |
| 20 using testing::Ge; | 19 using testing::Ge; |
| 21 using testing::InSequence; | 20 using testing::InSequence; |
| 22 using testing::Lt; | 21 using testing::Lt; |
| 23 using testing::Ne; | 22 using testing::Ne; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 TEST_F(InputStreamReaderTest, ReadSuccess) { | 162 TEST_F(InputStreamReaderTest, ReadSuccess) { |
| 164 const int bytesToRead = 128; | 163 const int bytesToRead = 128; |
| 165 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(bytesToRead); | 164 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(bytesToRead); |
| 166 | 165 |
| 167 EXPECT_CALL(input_stream_, Read(buffer.get(), bytesToRead, NotNull())) | 166 EXPECT_CALL(input_stream_, Read(buffer.get(), bytesToRead, NotNull())) |
| 168 .WillOnce(DoAll(SetArgPointee<2>(bytesToRead), | 167 .WillOnce(DoAll(SetArgPointee<2>(bytesToRead), |
| 169 Return(true))); | 168 Return(true))); |
| 170 | 169 |
| 171 ASSERT_EQ(bytesToRead, ReadRawData(buffer, bytesToRead)); | 170 ASSERT_EQ(bytesToRead, ReadRawData(buffer, bytesToRead)); |
| 172 } | 171 } |
| OLD | NEW |