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

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

Issue 229723002: Better error reasons for rAc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: woopsies Created 6 years, 8 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 class TestAutofillDialogController 253 class TestAutofillDialogController
254 : public AutofillDialogControllerImpl, 254 : public AutofillDialogControllerImpl,
255 public base::SupportsWeakPtr<TestAutofillDialogController> { 255 public base::SupportsWeakPtr<TestAutofillDialogController> {
256 public: 256 public:
257 TestAutofillDialogController( 257 TestAutofillDialogController(
258 content::WebContents* contents, 258 content::WebContents* contents,
259 const FormData& form_structure, 259 const FormData& form_structure,
260 const GURL& source_url, 260 const GURL& source_url,
261 const AutofillMetrics& metric_logger, 261 const AutofillMetrics& metric_logger,
262 const base::Callback<void(const FormStructure*)>& callback, 262 const AutofillManagerDelegate::ResultCallback& callback,
263 MockNewCreditCardBubbleController* mock_new_card_bubble_controller) 263 MockNewCreditCardBubbleController* mock_new_card_bubble_controller)
264 : AutofillDialogControllerImpl(contents, 264 : AutofillDialogControllerImpl(contents,
265 form_structure, 265 form_structure,
266 source_url, 266 source_url,
267 callback), 267 callback),
268 metric_logger_(metric_logger), 268 metric_logger_(metric_logger),
269 mock_wallet_client_( 269 mock_wallet_client_(
270 Profile::FromBrowserContext(contents->GetBrowserContext())-> 270 Profile::FromBrowserContext(contents->GetBrowserContext())->
271 GetRequestContext(), this, source_url), 271 GetRequestContext(), this, source_url),
272 mock_new_card_bubble_controller_(mock_new_card_bubble_controller), 272 mock_new_card_bubble_controller_(mock_new_card_bubble_controller),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 form_data.fields.push_back(field); 442 form_data.fields.push_back(field);
443 } 443 }
444 return form_data; 444 return form_data;
445 } 445 }
446 446
447 // Creates a new controller for |form_data|. 447 // Creates a new controller for |form_data|.
448 void ResetControllerWithFormData(const FormData& form_data) { 448 void ResetControllerWithFormData(const FormData& form_data) {
449 if (controller_) 449 if (controller_)
450 controller_->ViewClosed(); 450 controller_->ViewClosed();
451 451
452 base::Callback<void(const FormStructure*)> callback = 452 AutofillManagerDelegate::ResultCallback callback =
453 base::Bind(&AutofillDialogControllerTest::FinishedCallback, 453 base::Bind(&AutofillDialogControllerTest::FinishedCallback,
454 base::Unretained(this)); 454 base::Unretained(this));
455 controller_ = (new testing::NiceMock<TestAutofillDialogController>( 455 controller_ = (new testing::NiceMock<TestAutofillDialogController>(
456 web_contents(), 456 web_contents(),
457 form_data, 457 form_data,
458 GURL(kSourceUrl), 458 GURL(kSourceUrl),
459 metric_logger_, 459 metric_logger_,
460 callback, 460 callback,
461 mock_new_card_bubble_controller_.get()))->AsWeakPtr(); 461 mock_new_card_bubble_controller_.get()))->AsWeakPtr();
462 controller_->Init(profile()); 462 controller_->Init(profile());
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 640
641 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() { 641 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() {
642 return test_generated_bubble_controller_; 642 return test_generated_bubble_controller_;
643 } 643 }
644 644
645 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() { 645 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() {
646 return mock_new_card_bubble_controller_.get(); 646 return mock_new_card_bubble_controller_.get();
647 } 647 }
648 648
649 private: 649 private:
650 void FinishedCallback(const FormStructure* form_structure) { 650 void FinishedCallback(
651 AutofillManagerDelegate::RequestAutocompleteResult result,
652 const FormStructure* form_structure) {
651 form_structure_ = form_structure; 653 form_structure_ = form_structure;
652 } 654 }
653 655
654 #if defined(OS_WIN) 656 #if defined(OS_WIN)
655 // http://crbug.com/227221 657 // http://crbug.com/227221
656 ui::ScopedOleInitializer ole_initializer_; 658 ui::ScopedOleInitializer ole_initializer_;
657 #endif 659 #endif
658 660
659 // The controller owns itself. 661 // The controller owns itself.
660 base::WeakPtr<TestAutofillDialogController> controller_; 662 base::WeakPtr<TestAutofillDialogController> controller_;
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 SECTION_SHIPPING, 3404 SECTION_SHIPPING,
3403 NAME_FULL, 3405 NAME_FULL,
3404 gfx::NativeView(), 3406 gfx::NativeView(),
3405 gfx::Rect(), 3407 gfx::Rect(),
3406 profile.GetRawInfo(NAME_FULL).substr(0, 1), 3408 profile.GetRawInfo(NAME_FULL).substr(0, 1),
3407 true); 3409 true);
3408 EXPECT_EQ(NAME_FULL, controller()->popup_input_type()); 3410 EXPECT_EQ(NAME_FULL, controller()->popup_input_type());
3409 } 3411 }
3410 3412
3411 } // namespace autofill 3413 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698