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

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

Issue 2295693004: Pass JavaRef to Java methods in android_webview. (Closed)
Patch Set: Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/native/aw_contents_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 } // namespace 74 } // namespace
75 75
76 void AwContentsClientBridgeTest::SetUp() { 76 void AwContentsClientBridgeTest::SetUp() {
77 env_ = AttachCurrentThread(); 77 env_ = AttachCurrentThread();
78 ASSERT_THAT(env_, NotNull()); 78 ASSERT_THAT(env_, NotNull());
79 ASSERT_TRUE(android_webview::RegisterAwContentsClientBridge(env_)); 79 ASSERT_TRUE(android_webview::RegisterAwContentsClientBridge(env_));
80 ASSERT_TRUE(net::android::RegisterJni(env_)); 80 ASSERT_TRUE(net::android::RegisterJni(env_));
81 jbridge_.Reset(env_, 81 jbridge_.Reset(env_,
82 Java_MockAwContentsClientBridge_getAwContentsClientBridge(env_).obj()); 82 Java_MockAwContentsClientBridge_getAwContentsClientBridge(env_).obj());
83 bridge_.reset(new AwContentsClientBridge(env_, jbridge_.obj())); 83 bridge_.reset(new AwContentsClientBridge(env_, jbridge_));
84 selected_cert_ = nullptr; 84 selected_cert_ = nullptr;
85 cert_selected_callbacks_ = 0; 85 cert_selected_callbacks_ = 0;
86 cert_request_info_ = new net::SSLCertRequestInfo; 86 cert_request_info_ = new net::SSLCertRequestInfo;
87 } 87 }
88 88
89 void AwContentsClientBridgeTest::CertSelected(X509Certificate* cert) { 89 void AwContentsClientBridgeTest::CertSelected(X509Certificate* cert) {
90 selected_cert_ = cert; 90 selected_cert_ = cert;
91 cert_selected_callbacks_++; 91 cert_selected_callbacks_++;
92 } 92 }
93 93
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::WrapUnique(new TestClientCertificateDelegate(this))); 150 base::WrapUnique(new TestClientCertificateDelegate(this)));
151 int requestId = Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_); 151 int requestId = Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_);
152 bridge_->ProvideClientCertificateResponse(env_, jbridge_, requestId, nullptr, 152 bridge_->ProvideClientCertificateResponse(env_, jbridge_, requestId, nullptr,
153 nullptr); 153 nullptr);
154 base::RunLoop().RunUntilIdle(); 154 base::RunLoop().RunUntilIdle();
155 EXPECT_EQ(nullptr, selected_cert_); 155 EXPECT_EQ(nullptr, selected_cert_);
156 EXPECT_EQ(1, cert_selected_callbacks_); 156 EXPECT_EQ(1, cert_selected_callbacks_);
157 } 157 }
158 158
159 } // android_webview 159 } // android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_client_bridge.cc ('k') | android_webview/native/aw_contents_io_thread_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698