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

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

Issue 306053008: Rename AutofillManagerDelegate to AutofillClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 class TestAutofillDialogController 249 class TestAutofillDialogController
250 : public AutofillDialogControllerImpl, 250 : public AutofillDialogControllerImpl,
251 public base::SupportsWeakPtr<TestAutofillDialogController> { 251 public base::SupportsWeakPtr<TestAutofillDialogController> {
252 public: 252 public:
253 TestAutofillDialogController( 253 TestAutofillDialogController(
254 content::WebContents* contents, 254 content::WebContents* contents,
255 const FormData& form_structure, 255 const FormData& form_structure,
256 const GURL& source_url, 256 const GURL& source_url,
257 const AutofillMetrics& metric_logger, 257 const AutofillMetrics& metric_logger,
258 const AutofillManagerDelegate::ResultCallback& callback, 258 const AutofillClient::ResultCallback& callback,
259 MockNewCreditCardBubbleController* mock_new_card_bubble_controller) 259 MockNewCreditCardBubbleController* mock_new_card_bubble_controller)
260 : AutofillDialogControllerImpl(contents, 260 : AutofillDialogControllerImpl(contents,
261 form_structure, 261 form_structure,
262 source_url, 262 source_url,
263 callback), 263 callback),
264 metric_logger_(metric_logger), 264 metric_logger_(metric_logger),
265 mock_wallet_client_( 265 mock_wallet_client_(
266 Profile::FromBrowserContext(contents->GetBrowserContext())-> 266 Profile::FromBrowserContext(contents->GetBrowserContext())
267 GetRequestContext(), this, source_url), 267 ->GetRequestContext(),
268 this,
269 source_url),
268 mock_new_card_bubble_controller_(mock_new_card_bubble_controller), 270 mock_new_card_bubble_controller_(mock_new_card_bubble_controller),
269 submit_button_delay_count_(0) {} 271 submit_button_delay_count_(0) {}
270 272
271 virtual ~TestAutofillDialogController() {} 273 virtual ~TestAutofillDialogController() {}
272 274
273 virtual AutofillDialogView* CreateView() OVERRIDE { 275 virtual AutofillDialogView* CreateView() OVERRIDE {
274 return new testing::NiceMock<TestAutofillDialogView>(); 276 return new testing::NiceMock<TestAutofillDialogView>();
275 } 277 }
276 278
277 void Init(content::BrowserContext* browser_context) { 279 void Init(content::BrowserContext* browser_context) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 form_data.fields.push_back(field); 440 form_data.fields.push_back(field);
439 } 441 }
440 return form_data; 442 return form_data;
441 } 443 }
442 444
443 // Creates a new controller for |form_data|. 445 // Creates a new controller for |form_data|.
444 void ResetControllerWithFormData(const FormData& form_data) { 446 void ResetControllerWithFormData(const FormData& form_data) {
445 if (controller_) 447 if (controller_)
446 controller_->ViewClosed(); 448 controller_->ViewClosed();
447 449
448 AutofillManagerDelegate::ResultCallback callback = 450 AutofillClient::ResultCallback callback =
449 base::Bind(&AutofillDialogControllerTest::FinishedCallback, 451 base::Bind(&AutofillDialogControllerTest::FinishedCallback,
450 base::Unretained(this)); 452 base::Unretained(this));
451 controller_ = (new testing::NiceMock<TestAutofillDialogController>( 453 controller_ = (new testing::NiceMock<TestAutofillDialogController>(
452 web_contents(), 454 web_contents(),
453 form_data, 455 form_data,
454 GURL(kSourceUrl), 456 GURL(kSourceUrl),
455 metric_logger_, 457 metric_logger_,
456 callback, 458 callback,
457 mock_new_card_bubble_controller_.get()))->AsWeakPtr(); 459 mock_new_card_bubble_controller_.get()))->AsWeakPtr();
458 controller_->Init(profile()); 460 controller_->Init(profile());
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 639
638 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() { 640 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() {
639 return test_generated_bubble_controller_; 641 return test_generated_bubble_controller_;
640 } 642 }
641 643
642 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() { 644 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() {
643 return mock_new_card_bubble_controller_.get(); 645 return mock_new_card_bubble_controller_.get();
644 } 646 }
645 647
646 private: 648 private:
647 void FinishedCallback( 649 void FinishedCallback(AutofillClient::RequestAutocompleteResult result,
648 AutofillManagerDelegate::RequestAutocompleteResult result, 650 const base::string16& debug_message,
649 const base::string16& debug_message, 651 const FormStructure* form_structure) {
650 const FormStructure* form_structure) {
651 form_structure_ = form_structure; 652 form_structure_ = form_structure;
652 } 653 }
653 654
654 #if defined(OS_WIN) 655 #if defined(OS_WIN)
655 // http://crbug.com/227221 656 // http://crbug.com/227221
656 ui::ScopedOleInitializer ole_initializer_; 657 ui::ScopedOleInitializer ole_initializer_;
657 #endif 658 #endif
658 659
659 // The controller owns itself. 660 // The controller owns itself.
660 base::WeakPtr<TestAutofillDialogController> controller_; 661 base::WeakPtr<TestAutofillDialogController> controller_;
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
3528 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2); 3529 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2);
3529 3530
3530 FieldValueMap outputs; 3531 FieldValueMap outputs;
3531 outputs[NAME_FULL] = ASCIIToUTF16("madonna"); 3532 outputs[NAME_FULL] = ASCIIToUTF16("madonna");
3532 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs); 3533 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs);
3533 3534
3534 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill()); 3535 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill());
3535 } 3536 }
3536 3537
3537 } // namespace autofill 3538 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698