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

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

Issue 1304143010: Plumbing SSLPrivateKey Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase. Created 4 years, 10 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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "content/public/browser/client_certificate_delegate.h" 14 #include "content/public/browser/client_certificate_delegate.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "jni/MockAwContentsClientBridge_jni.h" 16 #include "jni/MockAwContentsClientBridge_jni.h"
17 #include "net/android/net_jni_registrar.h" 17 #include "net/android/net_jni_registrar.h"
18 #include "net/ssl/ssl_cert_request_info.h" 18 #include "net/ssl/ssl_cert_request_info.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 using base::android::AttachCurrentThread; 22 using base::android::AttachCurrentThread;
23 using base::android::ScopedJavaLocalRef; 23 using base::android::ScopedJavaLocalRef;
24 using net::SSLCertRequestInfo; 24 using net::SSLCertRequestInfo;
25 using net::SSLClientCertType; 25 using net::SSLClientCertType;
26 using net::SSLPrivateKey;
26 using net::X509Certificate; 27 using net::X509Certificate;
27 using testing::NotNull; 28 using testing::NotNull;
28 using testing::Test; 29 using testing::Test;
29 30
30 namespace android_webview { 31 namespace android_webview {
31 32
32 namespace { 33 namespace {
33 34
34 // Tests the android_webview contents client bridge. 35 // Tests the android_webview contents client bridge.
35 class AwContentsClientBridgeTest : public Test { 36 class AwContentsClientBridgeTest : public Test {
(...skipping 15 matching lines...) Expand all
51 JNIEnv* env_; 52 JNIEnv* env_;
52 }; 53 };
53 54
54 class TestClientCertificateDelegate 55 class TestClientCertificateDelegate
55 : public content::ClientCertificateDelegate { 56 : public content::ClientCertificateDelegate {
56 public: 57 public:
57 explicit TestClientCertificateDelegate(AwContentsClientBridgeTest* test) 58 explicit TestClientCertificateDelegate(AwContentsClientBridgeTest* test)
58 : test_(test) {} 59 : test_(test) {}
59 60
60 // content::ClientCertificateDelegate. 61 // content::ClientCertificateDelegate.
61 void ContinueWithCertificate(net::X509Certificate* cert) override { 62 void ContinueWithCertificate(net::X509Certificate* cert,
63 net::SSLPrivateKey* private_key) override {
62 test_->CertSelected(cert); 64 test_->CertSelected(cert);
63 test_ = nullptr; 65 test_ = nullptr;
64 } 66 }
65 67
66 private: 68 private:
67 AwContentsClientBridgeTest* test_; 69 AwContentsClientBridgeTest* test_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(TestClientCertificateDelegate); 71 DISALLOW_COPY_AND_ASSIGN(TestClientCertificateDelegate);
70 }; 72 };
71 73
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 int requestId = 152 int requestId =
151 Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_.obj()); 153 Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_.obj());
152 bridge_->ProvideClientCertificateResponse(env_, jbridge_, requestId, nullptr, 154 bridge_->ProvideClientCertificateResponse(env_, jbridge_, requestId, nullptr,
153 nullptr); 155 nullptr);
154 base::RunLoop().RunUntilIdle(); 156 base::RunLoop().RunUntilIdle();
155 EXPECT_EQ(nullptr, selected_cert_); 157 EXPECT_EQ(nullptr, selected_cert_);
156 EXPECT_EQ(1, cert_selected_callbacks_); 158 EXPECT_EQ(1, cert_selected_callbacks_);
157 } 159 }
158 160
159 } // android_webview 161 } // android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_client_bridge.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698