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

Side by Side Diff: chrome/browser/ui/autofill/card_unmask_prompt_view_browsertest.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 6 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 (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/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/autofill/risk_util.h" 9 #include "chrome/browser/autofill/risk_util.h"
10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view_tester.h" 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view_tester.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 delegate()->GetWeakPtr()); 129 delegate()->GetWeakPtr());
130 controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"), 130 controller()->OnUnmaskResponse(base::ASCIIToUTF16("123"),
131 base::ASCIIToUTF16("10"), 131 base::ASCIIToUTF16("10"),
132 base::ASCIIToUTF16("19"), false); 132 base::ASCIIToUTF16("19"), false);
133 EXPECT_EQ(base::ASCIIToUTF16("123"), delegate()->response().cvc); 133 EXPECT_EQ(base::ASCIIToUTF16("123"), delegate()->response().cvc);
134 controller()->OnVerificationResult(AutofillClient::SUCCESS); 134 controller()->OnVerificationResult(AutofillClient::SUCCESS);
135 135
136 // Simulate the user clicking [x] before the "Success!" message disappears. 136 // Simulate the user clicking [x] before the "Success!" message disappears.
137 CardUnmaskPromptViewTester::For(controller()->view())->Close(); 137 CardUnmaskPromptViewTester::For(controller()->view())->Close();
138 // Wait a little while; there should be no crash. 138 // Wait a little while; there should be no crash.
139 base::MessageLoop::current()->PostDelayedTask( 139 base::MessageLoop::current()->task_runner()->PostDelayedTask(
140 FROM_HERE, base::Bind(&content::MessageLoopRunner::Quit, 140 FROM_HERE, base::Bind(&content::MessageLoopRunner::Quit,
141 base::Unretained(runner_.get())), 141 base::Unretained(runner_.get())),
142 2 * controller()->GetSuccessMessageDuration()); 142 2 * controller()->GetSuccessMessageDuration());
143 runner_->Run(); 143 runner_->Run();
144 } 144 }
145 #endif 145 #endif
146 146
147 // Makes sure the tab can be closed while the dialog is showing. 147 // Makes sure the tab can be closed while the dialog is showing.
148 // https://crbug.com/484376 148 // https://crbug.com/484376
149 IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest, 149 IN_PROC_BROWSER_TEST_F(CardUnmaskPromptViewBrowserTest,
150 CloseTabWhileDialogShowing) { 150 CloseTabWhileDialogShowing) {
151 controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()), 151 controller()->ShowPrompt(CreateCardUnmaskPromptView(controller(), contents()),
152 test::GetMaskedServerCard(), 152 test::GetMaskedServerCard(),
153 delegate()->GetWeakPtr()); 153 delegate()->GetWeakPtr());
154 // Simulate AutofillManager (the delegate in production code) being destroyed 154 // Simulate AutofillManager (the delegate in production code) being destroyed
155 // before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called. 155 // before CardUnmaskPromptViewBridge::OnConstrainedWindowClosed() is called.
156 FreeDelegate(); 156 FreeDelegate();
157 browser()->tab_strip_model()->GetActiveWebContents()->Close(); 157 browser()->tab_strip_model()->GetActiveWebContents()->Close();
158 158
159 content::RunAllPendingInMessageLoop(); 159 content::RunAllPendingInMessageLoop();
160 } 160 }
161 161
162 } // namespace 162 } // namespace
163 163
164 } // namespace autofill 164 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698