Chromium Code Reviews| 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 | |
| 7 #include <memory> | |
|
boliu
2016/04/01 00:49:42
old scoped_ptr include is actually not needed, so
dcheng
2016/04/01 00:58:01
Done (this is all automated, and I'm not able to s
| |
| 8 | |
| 5 #include "android_webview/browser/input_stream.h" | 9 #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" | 10 #include "base/android/scoped_java_ref.h" |
| 8 #include "base/callback.h" | 11 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 12 #include "net/http/http_byte_range.h" | 14 #include "net/http/http_byte_range.h" |
| 13 | |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using android_webview::InputStream; | 18 using android_webview::InputStream; |
| 18 using android_webview::InputStreamReader; | 19 using android_webview::InputStreamReader; |
| 19 using testing::DoAll; | 20 using testing::DoAll; |
| 20 using testing::Ge; | 21 using testing::Ge; |
| 21 using testing::InSequence; | 22 using testing::InSequence; |
| 22 using testing::Lt; | 23 using testing::Lt; |
| 23 using testing::Ne; | 24 using testing::Ne; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 TEST_F(InputStreamReaderTest, ReadSuccess) { | 164 TEST_F(InputStreamReaderTest, ReadSuccess) { |
| 164 const int bytesToRead = 128; | 165 const int bytesToRead = 128; |
| 165 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(bytesToRead); | 166 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(bytesToRead); |
| 166 | 167 |
| 167 EXPECT_CALL(input_stream_, Read(buffer.get(), bytesToRead, NotNull())) | 168 EXPECT_CALL(input_stream_, Read(buffer.get(), bytesToRead, NotNull())) |
| 168 .WillOnce(DoAll(SetArgPointee<2>(bytesToRead), | 169 .WillOnce(DoAll(SetArgPointee<2>(bytesToRead), |
| 169 Return(true))); | 170 Return(true))); |
| 170 | 171 |
| 171 ASSERT_EQ(bytesToRead, ReadRawData(buffer, bytesToRead)); | 172 ASSERT_EQ(bytesToRead, ReadRawData(buffer, bytesToRead)); |
| 172 } | 173 } |
| OLD | NEW |