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/browser/content_credential_manager
_dispatcher.h" | 5 #include "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 RunAllPendingTasks(); | 124 RunAllPendingTasks(); |
125 | 125 |
126 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; | 126 const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; |
127 const IPC::Message* message = | 127 const IPC::Message* message = |
128 process()->sink().GetFirstMessageMatching(kMsgID); | 128 process()->sink().GetFirstMessageMatching(kMsgID); |
129 EXPECT_TRUE(message); | 129 EXPECT_TRUE(message); |
130 process()->sink().ClearMessages(); | 130 process()->sink().ClearMessages(); |
131 } | 131 } |
132 | 132 |
| 133 TEST_F(ContentCredentialManagerDispatcherTest, |
| 134 CredentialManagerOnRequestCredentialWhileRequestPending) { |
| 135 std::vector<GURL> federations; |
| 136 dispatcher()->OnRequestCredential(kRequestId, false, federations); |
| 137 dispatcher()->OnRequestCredential(kRequestId, false, federations); |
| 138 |
| 139 // Check that the second request triggered a rejection. |
| 140 uint32 kMsgID = CredentialManagerMsg_RejectCredentialRequest::ID; |
| 141 const IPC::Message* message = |
| 142 process()->sink().GetFirstMessageMatching(kMsgID); |
| 143 EXPECT_TRUE(message); |
| 144 process()->sink().ClearMessages(); |
| 145 |
| 146 // Execute the PasswordStore asynchronousness. |
| 147 RunAllPendingTasks(); |
| 148 |
| 149 // Check that the first request resolves. |
| 150 kMsgID = CredentialManagerMsg_SendCredential::ID; |
| 151 message = process()->sink().GetFirstMessageMatching(kMsgID); |
| 152 EXPECT_TRUE(message); |
| 153 process()->sink().ClearMessages(); |
| 154 } |
| 155 |
133 } // namespace password_manager | 156 } // namespace password_manager |
OLD | NEW |