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

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: android 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 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 base::Callback<void(const FormStructure*)>& callback, 258 const AutofillManagerDelegate::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(), this, source_url),
268 mock_new_card_bubble_controller_(mock_new_card_bubble_controller), 268 mock_new_card_bubble_controller_(mock_new_card_bubble_controller),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 form_data.fields.push_back(field); 438 form_data.fields.push_back(field);
439 } 439 }
440 return form_data; 440 return form_data;
441 } 441 }
442 442
443 // Creates a new controller for |form_data|. 443 // Creates a new controller for |form_data|.
444 void ResetControllerWithFormData(const FormData& form_data) { 444 void ResetControllerWithFormData(const FormData& form_data) {
445 if (controller_) 445 if (controller_)
446 controller_->ViewClosed(); 446 controller_->ViewClosed();
447 447
448 base::Callback<void(const FormStructure*)> callback = 448 AutofillManagerDelegate::ResultCallback callback =
449 base::Bind(&AutofillDialogControllerTest::FinishedCallback, 449 base::Bind(&AutofillDialogControllerTest::FinishedCallback,
450 base::Unretained(this)); 450 base::Unretained(this));
451 controller_ = (new testing::NiceMock<TestAutofillDialogController>( 451 controller_ = (new testing::NiceMock<TestAutofillDialogController>(
452 web_contents(), 452 web_contents(),
453 form_data, 453 form_data,
454 GURL(kSourceUrl), 454 GURL(kSourceUrl),
455 metric_logger_, 455 metric_logger_,
456 callback, 456 callback,
457 mock_new_card_bubble_controller_.get()))->AsWeakPtr(); 457 mock_new_card_bubble_controller_.get()))->AsWeakPtr();
458 controller_->Init(profile()); 458 controller_->Init(profile());
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 636
637 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() { 637 TestGeneratedCreditCardBubbleController* test_generated_bubble_controller() {
638 return test_generated_bubble_controller_; 638 return test_generated_bubble_controller_;
639 } 639 }
640 640
641 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() { 641 const MockNewCreditCardBubbleController* mock_new_card_bubble_controller() {
642 return mock_new_card_bubble_controller_.get(); 642 return mock_new_card_bubble_controller_.get();
643 } 643 }
644 644
645 private: 645 private:
646 void FinishedCallback(const FormStructure* form_structure) { 646 void FinishedCallback(
647 AutofillManagerDelegate::RequestAutocompleteResult result,
648 const FormStructure* form_structure) {
647 form_structure_ = form_structure; 649 form_structure_ = form_structure;
648 } 650 }
649 651
650 #if defined(OS_WIN) 652 #if defined(OS_WIN)
651 // http://crbug.com/227221 653 // http://crbug.com/227221
652 ui::ScopedOleInitializer ole_initializer_; 654 ui::ScopedOleInitializer ole_initializer_;
653 #endif 655 #endif
654 656
655 // The controller owns itself. 657 // The controller owns itself.
656 base::WeakPtr<TestAutofillDialogController> controller_; 658 base::WeakPtr<TestAutofillDialogController> controller_;
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3398 SECTION_SHIPPING, 3400 SECTION_SHIPPING,
3399 NAME_FULL, 3401 NAME_FULL,
3400 gfx::NativeView(), 3402 gfx::NativeView(),
3401 gfx::Rect(), 3403 gfx::Rect(),
3402 profile.GetRawInfo(NAME_FULL).substr(0, 1), 3404 profile.GetRawInfo(NAME_FULL).substr(0, 1),
3403 true); 3405 true);
3404 EXPECT_EQ(NAME_FULL, controller()->popup_input_type()); 3406 EXPECT_EQ(NAME_FULL, controller()->popup_input_type());
3405 } 3407 }
3406 3408
3407 } // namespace autofill 3409 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698