| OLD | NEW | 
|    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 "base/guid.h" |    5 #include "base/guid.h" | 
|    6 #include "base/memory/scoped_ptr.h" |    6 #include "base/memory/scoped_ptr.h" | 
|    7 #include "base/prefs/pref_service.h" |    7 #include "base/prefs/pref_service.h" | 
|    8 #include "base/utf_string_conversions.h" |    8 #include "base/utf_string_conversions.h" | 
|    9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |    9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 
|   10 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |   10 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  132         ALLOW_THIS_IN_INITIALIZER_LIST(test_wallet_client_( |  132         ALLOW_THIS_IN_INITIALIZER_LIST(test_wallet_client_( | 
|  133             Profile::FromBrowserContext(contents->GetBrowserContext())-> |  133             Profile::FromBrowserContext(contents->GetBrowserContext())-> | 
|  134                 GetRequestContext(), this)), |  134                 GetRequestContext(), this)), | 
|  135         is_paying_with_wallet_(false) {} |  135         is_paying_with_wallet_(false) {} | 
|  136   virtual ~TestAutofillDialogController() {} |  136   virtual ~TestAutofillDialogController() {} | 
|  137  |  137  | 
|  138   virtual AutofillDialogView* CreateView() OVERRIDE { |  138   virtual AutofillDialogView* CreateView() OVERRIDE { | 
|  139     return new TestAutofillDialogView(); |  139     return new TestAutofillDialogView(); | 
|  140   } |  140   } | 
|  141  |  141  | 
 |  142   void Init(content::BrowserContext* browser_context) { | 
 |  143     test_manager_.Init(browser_context); | 
 |  144   } | 
 |  145  | 
|  142   TestAutofillDialogView* GetView() { |  146   TestAutofillDialogView* GetView() { | 
|  143     return static_cast<TestAutofillDialogView*>(view()); |  147     return static_cast<TestAutofillDialogView*>(view()); | 
|  144   } |  148   } | 
|  145  |  149  | 
|  146   TestPersonalDataManager* GetTestingManager() { |  150   TestPersonalDataManager* GetTestingManager() { | 
|  147     return &test_manager_; |  151     return &test_manager_; | 
|  148   } |  152   } | 
|  149  |  153  | 
|  150   TestWalletClient* GetTestingWalletClient() { |  154   TestWalletClient* GetTestingWalletClient() { | 
|  151     return &test_wallet_client_; |  155     return &test_wallet_client_; | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  204         content::WebContentsTester::CreateTestWebContents(profile(), NULL)); |  208         content::WebContentsTester::CreateTestWebContents(profile(), NULL)); | 
|  205  |  209  | 
|  206     base::Callback<void(const FormStructure*)> callback; |  210     base::Callback<void(const FormStructure*)> callback; | 
|  207     controller_ = new TestAutofillDialogController( |  211     controller_ = new TestAutofillDialogController( | 
|  208         test_web_contents_.get(), |  212         test_web_contents_.get(), | 
|  209         form_data, |  213         form_data, | 
|  210         GURL(), |  214         GURL(), | 
|  211         metric_logger_, |  215         metric_logger_, | 
|  212         DIALOG_TYPE_REQUEST_AUTOCOMPLETE, |  216         DIALOG_TYPE_REQUEST_AUTOCOMPLETE, | 
|  213         callback); |  217         callback); | 
 |  218     controller_->Init(profile()); | 
|  214     controller_->Show(); |  219     controller_->Show(); | 
|  215   } |  220   } | 
|  216  |  221  | 
|  217   virtual void TearDown() OVERRIDE { |  222   virtual void TearDown() OVERRIDE { | 
|  218     controller_->ViewClosed(); |  223     controller_->ViewClosed(); | 
|  219   } |  224   } | 
|  220  |  225  | 
|  221  protected: |  226  protected: | 
|  222   TestAutofillDialogController* controller() { return controller_; } |  227   TestAutofillDialogController* controller() { return controller_; } | 
|  223  |  228  | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  419  |  424  | 
|  420   // When edit is cancelled, the autofilled_value should be empty. |  425   // When edit is cancelled, the autofilled_value should be empty. | 
|  421   controller()->EditCancelledForSection(SECTION_EMAIL); |  426   controller()->EditCancelledForSection(SECTION_EMAIL); | 
|  422   const DetailInputs& inputs2 = |  427   const DetailInputs& inputs2 = | 
|  423       controller()->RequestedFieldsForSection(SECTION_EMAIL); |  428       controller()->RequestedFieldsForSection(SECTION_EMAIL); | 
|  424   EXPECT_EQ(kEmail, controller()->SuggestionTextForSection(SECTION_EMAIL)); |  429   EXPECT_EQ(kEmail, controller()->SuggestionTextForSection(SECTION_EMAIL)); | 
|  425   EXPECT_EQ(string16(), inputs2[0].autofilled_value); |  430   EXPECT_EQ(string16(), inputs2[0].autofilled_value); | 
|  426 } |  431 } | 
|  427  |  432  | 
|  428 }  // namespace autofill |  433 }  // namespace autofill | 
| OLD | NEW |