OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/guid.h" | 6 #include "base/guid.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"), | 152 controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"), |
153 base::ASCIIToUTF16("10"), | 153 base::ASCIIToUTF16("10"), |
154 base::ASCIIToUTF16("19"), false); | 154 base::ASCIIToUTF16("19"), false); |
155 EXPECT_EQ(base::ASCIIToUTF16("123"), delegate()->response().cvc); | 155 EXPECT_EQ(base::ASCIIToUTF16("123"), delegate()->response().cvc); |
156 controller()->OnVerificationResult(AutofillClient::SUCCESS); | 156 controller()->OnVerificationResult(AutofillClient::SUCCESS); |
157 | 157 |
158 // Simulate the user clicking [x] before the "Success!" message disappears. | 158 // Simulate the user clicking [x] before the "Success!" message disappears. |
159 CardUnmaskPromptViewTester::For(controller()->view())->Close(); | 159 CardUnmaskPromptViewTester::For(controller()->view())->Close(); |
160 // Wait a little while; there should be no crash. | 160 // Wait a little while; there should be no crash. |
161 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 161 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
162 FROM_HERE, base::Bind(&content::MessageLoopRunner::Quit, | 162 FROM_HERE, |
163 base::Unretained(runner_.get())), | 163 base::BindOnce(&content::MessageLoopRunner::Quit, |
| 164 base::Unretained(runner_.get())), |
164 2 * controller()->GetSuccessMessageDuration()); | 165 2 * controller()->GetSuccessMessageDuration()); |
165 runner_->Run(); | 166 runner_->Run(); |
166 } | 167 } |
167 #endif | 168 #endif |
168 | 169 |
169 // Makes sure the tab can be closed while the dialog is showing. | 170 // Makes sure the tab can be closed while the dialog is showing. |
170 // https://crbug.com/484376 | 171 // https://crbug.com/484376 |
171 IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, | 172 IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, |
172 CloseTabWhileDialogShowing) { | 173 CloseTabWhileDialogShowing) { |
173 ShowDialog(kExpiryExpired); | 174 ShowDialog(kExpiryExpired); |
174 // Simulate AutofillManager (the delegate in production code) being destroyed | 175 // Simulate AutofillManager (the delegate in production code) being destroyed |
175 // before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called. | 176 // before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called. |
176 FreeDelegate(); | 177 FreeDelegate(); |
177 browser()->tab_strip_model()->GetActiveWebContents()->Close(); | 178 browser()->tab_strip_model()->GetActiveWebContents()->Close(); |
178 | 179 |
179 content::RunAllPendingInMessageLoop(); | 180 content::RunAllPendingInMessageLoop(); |
180 } | 181 } |
181 | 182 |
182 } // namespace | 183 } // namespace |
183 | 184 |
184 } // namespace autofill | 185 } // namespace autofill |
OLD | NEW |