Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: android_webview/native/input_stream_unittest.cc

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, more fixes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 5 #include <memory>
6 6
7 #include "android_webview/native/input_stream_impl.h" 7 #include "android_webview/native/input_stream_impl.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "jni/InputStreamUnittest_jni.h" 10 #include "jni/InputStreamUnittest_jni.h"
(...skipping 17 matching lines...) Expand all
28 using testing::Return; 28 using testing::Return;
29 using testing::SetArgPointee; 29 using testing::SetArgPointee;
30 using testing::Test; 30 using testing::Test;
31 using testing::_; 31 using testing::_;
32 32
33 class InputStreamTest : public Test { 33 class InputStreamTest : public Test {
34 public: 34 public:
35 InputStreamTest() { 35 InputStreamTest() {
36 } 36 }
37 protected: 37 protected:
38 void SetUp() override {
39 env_ = AttachCurrentThread();
40 ASSERT_THAT(env_, NotNull());
41 ASSERT_TRUE(android_webview::RegisterInputStream(env_));
42 ASSERT_TRUE(RegisterNativesImpl(env_));
43 }
44
45 scoped_refptr<IOBuffer> DoReadCountedStreamTest(int stream_size, 38 scoped_refptr<IOBuffer> DoReadCountedStreamTest(int stream_size,
46 int bytes_requested, 39 int bytes_requested,
47 int* bytes_read) { 40 int* bytes_read) {
48 ScopedJavaLocalRef<jobject> counting_jstream = 41 ScopedJavaLocalRef<jobject> counting_jstream =
49 Java_InputStreamUnittest_getCountingStream(env_, stream_size); 42 Java_InputStreamUnittest_getCountingStream(env_, stream_size);
50 EXPECT_FALSE(counting_jstream.is_null()); 43 EXPECT_FALSE(counting_jstream.is_null());
51 44
52 std::unique_ptr<InputStream> input_stream( 45 std::unique_ptr<InputStream> input_stream(
53 new InputStreamImpl(counting_jstream)); 46 new InputStreamImpl(counting_jstream));
54 scoped_refptr<IOBuffer> buffer = new IOBuffer(bytes_requested); 47 scoped_refptr<IOBuffer> buffer = new IOBuffer(bytes_requested);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 129
137 const int bytes_requested = 10; 130 const int bytes_requested = 10;
138 int bytes_read = 0; 131 int bytes_read = 0;
139 scoped_refptr<IOBuffer> buffer = new IOBuffer(bytes_requested); 132 scoped_refptr<IOBuffer> buffer = new IOBuffer(bytes_requested);
140 EXPECT_FALSE(input_stream->Read(buffer.get(), bytes_requested, &bytes_read)); 133 EXPECT_FALSE(input_stream->Read(buffer.get(), bytes_requested, &bytes_read));
141 EXPECT_EQ(0, bytes_read); 134 EXPECT_EQ(0, bytes_read);
142 135
143 // This closes the stream. 136 // This closes the stream.
144 input_stream.reset(NULL); 137 input_stream.reset(NULL);
145 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698