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/renderer/credential_manager_client
.h" | 5 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <tuple> | 10 #include <tuple> |
11 | 11 |
| 12 #include "base/location.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
12 #include "content/public/common/service_registry.h" | 15 #include "content/public/common/service_registry.h" |
13 #include "content/public/renderer/render_frame.h" | 16 #include "content/public/renderer/render_frame.h" |
14 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
15 #include "content/public/test/render_view_test.h" | 18 #include "content/public/test/render_view_test.h" |
16 #include "mojo/public/cpp/bindings/binding_set.h" | 19 #include "mojo/public/cpp/bindings/binding_set.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/WebKit/public/platform/WebCredential.h" | 21 #include "third_party/WebKit/public/platform/WebCredential.h" |
19 #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h" | 22 #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h" |
20 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" | 23 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" |
21 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" | 24 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 test_->credential_.reset(); | 165 test_->credential_.reset(); |
163 test_->error_ = reason; | 166 test_->error_ = reason; |
164 } | 167 } |
165 | 168 |
166 private: | 169 private: |
167 CredentialManagerClientTest* test_; | 170 CredentialManagerClientTest* test_; |
168 }; | 171 }; |
169 | 172 |
170 void RunAllPendingTasks() { | 173 void RunAllPendingTasks() { |
171 base::RunLoop run_loop; | 174 base::RunLoop run_loop; |
172 base::MessageLoop::current()->PostTask( | 175 base::ThreadTaskRunnerHandle::Get()->PostTask( |
173 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 176 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
174 run_loop.Run(); | 177 run_loop.Run(); |
175 } | 178 } |
176 | 179 |
177 } // namespace | 180 } // namespace |
178 | 181 |
179 TEST_F(CredentialManagerClientTest, SendStore) { | 182 TEST_F(CredentialManagerClientTest, SendStore) { |
180 credential_.reset(new blink::WebPasswordCredential("", "", "", GURL())); | 183 credential_.reset(new blink::WebPasswordCredential("", "", "", GURL())); |
181 std::unique_ptr<TestNotificationCallbacks> callbacks( | 184 std::unique_ptr<TestNotificationCallbacks> callbacks( |
182 new TestNotificationCallbacks(this)); | 185 new TestNotificationCallbacks(this)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 242 |
240 EXPECT_FALSE(callback_succeeded()); | 243 EXPECT_FALSE(callback_succeeded()); |
241 EXPECT_TRUE(callback_errored()); | 244 EXPECT_TRUE(callback_errored()); |
242 EXPECT_FALSE(credential_); | 245 EXPECT_FALSE(credential_); |
243 EXPECT_EQ(blink::WebCredentialManagerError:: | 246 EXPECT_EQ(blink::WebCredentialManagerError:: |
244 WebCredentialManagerPasswordStoreUnavailableError, | 247 WebCredentialManagerPasswordStoreUnavailableError, |
245 error_); | 248 error_); |
246 } | 249 } |
247 | 250 |
248 } // namespace password_manager | 251 } // namespace password_manager |
OLD | NEW |