| OLD | NEW |
| 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 "components/password_manager/content/common/credential_manager_messages
.h" | 5 #include "components/password_manager/content/common/credential_manager_messages
.h" |
| 6 #include "components/password_manager/content/renderer/credential_manager_client
.h" | 6 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
| 7 #include "content/public/test/render_view_test.h" | 7 #include "content/public/test/render_view_test.h" |
| 8 #include "ipc/ipc_test_sink.h" | 8 #include "ipc/ipc_test_sink.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/public/platform/WebCredential.h" | 10 #include "third_party/WebKit/public/platform/WebCredential.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 scoped_ptr<blink::WebPasswordCredential> credential_; | 99 scoped_ptr<blink::WebPasswordCredential> credential_; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 class TestNotificationCallbacks | 102 class TestNotificationCallbacks |
| 103 : public blink::WebCredentialManagerClient::NotificationCallbacks { | 103 : public blink::WebCredentialManagerClient::NotificationCallbacks { |
| 104 public: | 104 public: |
| 105 explicit TestNotificationCallbacks(CredentialManagerClientTest* test) | 105 explicit TestNotificationCallbacks(CredentialManagerClientTest* test) |
| 106 : test_(test) {} | 106 : test_(test) {} |
| 107 | 107 |
| 108 virtual ~TestNotificationCallbacks() {} | 108 ~TestNotificationCallbacks() override {} |
| 109 | 109 |
| 110 virtual void onSuccess() { test_->set_callback_succeeded(true); } | 110 void onSuccess() override { test_->set_callback_succeeded(true); } |
| 111 | 111 |
| 112 virtual void onError(blink::WebCredentialManagerError* reason) { | 112 void onError(blink::WebCredentialManagerError* reason) override { |
| 113 test_->set_callback_errored(true); | 113 test_->set_callback_errored(true); |
| 114 } | 114 } |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 CredentialManagerClientTest* test_; | 117 CredentialManagerClientTest* test_; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 class TestRequestCallbacks | 120 class TestRequestCallbacks |
| 121 : public blink::WebCredentialManagerClient::RequestCallbacks { | 121 : public blink::WebCredentialManagerClient::RequestCallbacks { |
| 122 public: | 122 public: |
| 123 explicit TestRequestCallbacks(CredentialManagerClientTest* test) | 123 explicit TestRequestCallbacks(CredentialManagerClientTest* test) |
| 124 : test_(test) {} | 124 : test_(test) {} |
| 125 | 125 |
| 126 virtual ~TestRequestCallbacks() {} | 126 ~TestRequestCallbacks() override {} |
| 127 | 127 |
| 128 virtual void onSuccess(blink::WebCredential*) { | 128 void onSuccess(blink::WebCredential*) override { |
| 129 test_->set_callback_succeeded(true); | 129 test_->set_callback_succeeded(true); |
| 130 } | 130 } |
| 131 | 131 |
| 132 virtual void onError(blink::WebCredentialManagerError* reason) { | 132 void onError(blink::WebCredentialManagerError* reason) override { |
| 133 test_->set_callback_errored(true); | 133 test_->set_callback_errored(true); |
| 134 } | 134 } |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 CredentialManagerClientTest* test_; | 137 CredentialManagerClientTest* test_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace | 140 } // namespace |
| 141 | 141 |
| 142 TEST_F(CredentialManagerClientTest, SendStore) { | 142 TEST_F(CredentialManagerClientTest, SendStore) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 203 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
| 204 request_id)); | 204 request_id)); |
| 205 | 205 |
| 206 CredentialInfo info; // Send an empty credential in response. | 206 CredentialInfo info; // Send an empty credential in response. |
| 207 client_->OnSendCredential(request_id, info); | 207 client_->OnSendCredential(request_id, info); |
| 208 EXPECT_TRUE(callback_succeeded()); | 208 EXPECT_TRUE(callback_succeeded()); |
| 209 EXPECT_FALSE(callback_errored()); | 209 EXPECT_FALSE(callback_errored()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace password_manager | 212 } // namespace password_manager |
| OLD | NEW |