| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ssl_status, | 90 ssl_status, |
| 91 metric_logger, | 91 metric_logger, |
| 92 dialog_type, | 92 dialog_type, |
| 93 callback) {} | 93 callback) {} |
| 94 virtual ~TestAutofillDialogController() {} | 94 virtual ~TestAutofillDialogController() {} |
| 95 | 95 |
| 96 virtual AutofillDialogView* CreateView() OVERRIDE { | 96 virtual AutofillDialogView* CreateView() OVERRIDE { |
| 97 return new TestAutofillDialogView(); | 97 return new TestAutofillDialogView(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void Init(content::BrowserContext* browser_context) { |
| 101 test_manager_.Init(browser_context); |
| 102 } |
| 103 |
| 100 TestAutofillDialogView* GetView() { | 104 TestAutofillDialogView* GetView() { |
| 101 return static_cast<TestAutofillDialogView*>(view()); | 105 return static_cast<TestAutofillDialogView*>(view()); |
| 102 } | 106 } |
| 103 | 107 |
| 104 TestPersonalDataManager* GetTestingManager() { | 108 TestPersonalDataManager* GetTestingManager() { |
| 105 return &test_manager_; | 109 return &test_manager_; |
| 106 } | 110 } |
| 107 | 111 |
| 108 protected: | 112 protected: |
| 109 virtual PersonalDataManager* GetManager() OVERRIDE { | 113 virtual PersonalDataManager* GetManager() OVERRIDE { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::Callback<void(const FormStructure*)> callback; | 150 base::Callback<void(const FormStructure*)> callback; |
| 147 AutofillMetrics metrics; | 151 AutofillMetrics metrics; |
| 148 controller_ = new TestAutofillDialogController( | 152 controller_ = new TestAutofillDialogController( |
| 149 test_web_contents_.get(), | 153 test_web_contents_.get(), |
| 150 form_data, | 154 form_data, |
| 151 GURL(), | 155 GURL(), |
| 152 content::SSLStatus(), | 156 content::SSLStatus(), |
| 153 metrics, | 157 metrics, |
| 154 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, | 158 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, |
| 155 callback); | 159 callback); |
| 160 controller_->Init(profile()); |
| 156 controller_->Show(); | 161 controller_->Show(); |
| 157 } | 162 } |
| 158 | 163 |
| 159 virtual void TearDown() OVERRIDE { | 164 virtual void TearDown() OVERRIDE { |
| 160 controller_->ViewClosed(); | 165 controller_->ViewClosed(); |
| 161 } | 166 } |
| 162 | 167 |
| 163 protected: | 168 protected: |
| 164 TestAutofillDialogController* controller() { return controller_; } | 169 TestAutofillDialogController* controller() { return controller_; } |
| 165 | 170 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 email_model->ActivatedAt(1); | 265 email_model->ActivatedAt(1); |
| 261 EXPECT_EQ(kEmail2, controller()->SuggestionTextForSection(SECTION_EMAIL)); | 266 EXPECT_EQ(kEmail2, controller()->SuggestionTextForSection(SECTION_EMAIL)); |
| 262 | 267 |
| 263 controller()->EditClickedForSection(SECTION_EMAIL); | 268 controller()->EditClickedForSection(SECTION_EMAIL); |
| 264 const DetailInputs& inputs = | 269 const DetailInputs& inputs = |
| 265 controller()->RequestedFieldsForSection(SECTION_EMAIL); | 270 controller()->RequestedFieldsForSection(SECTION_EMAIL); |
| 266 EXPECT_EQ(kEmail2, inputs[0].autofilled_value); | 271 EXPECT_EQ(kEmail2, inputs[0].autofilled_value); |
| 267 } | 272 } |
| 268 | 273 |
| 269 } // namespace autofill | 274 } // namespace autofill |
| OLD | NEW |