| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 virtual ValidityData InputsAreValid( | 133 virtual ValidityData InputsAreValid( |
| 134 DialogSection section, | 134 DialogSection section, |
| 135 const DetailOutputMap& inputs, | 135 const DetailOutputMap& inputs, |
| 136 ValidationType validation_type) OVERRIDE { | 136 ValidationType validation_type) OVERRIDE { |
| 137 if (!use_validation_) | 137 if (!use_validation_) |
| 138 return ValidityData(); | 138 return ValidityData(); |
| 139 return AutofillDialogControllerImpl::InputsAreValid( | 139 return AutofillDialogControllerImpl::InputsAreValid( |
| 140 section, inputs, validation_type); | 140 section, inputs, validation_type); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Saving to Chrome is tested in AutofillDialogController unit tests. | 143 // Saving to Chrome is tested in AutofillDialogControllerImpl unit tests. |
| 144 // TODO(estade): test that the view defaults to saving to Chrome. | 144 // TODO(estade): test that the view defaults to saving to Chrome. |
| 145 virtual bool ShouldOfferToSaveInChrome() const OVERRIDE { | 145 virtual bool ShouldOfferToSaveInChrome() const OVERRIDE { |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Increase visibility for testing. | 149 // Increase visibility for testing. |
| 150 using AutofillDialogControllerImpl::view; | 150 using AutofillDialogControllerImpl::view; |
| 151 using AutofillDialogControllerImpl::input_showing_popup; | 151 using AutofillDialogControllerImpl::input_showing_popup; |
| 152 | 152 |
| 153 virtual std::vector<DialogNotification> CurrentNotifications() OVERRIDE { | 153 virtual std::vector<DialogNotification> CurrentNotifications() OVERRIDE { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 "</html>")); | 294 "</html>")); |
| 295 content::WaitForLoadStop(contents); | 295 content::WaitForLoadStop(contents); |
| 296 | 296 |
| 297 dom_message_queue_.reset(new content::DOMMessageQueue); | 297 dom_message_queue_.reset(new content::DOMMessageQueue); |
| 298 | 298 |
| 299 // Triggers the onclick handler which invokes requestAutocomplete(). | 299 // Triggers the onclick handler which invokes requestAutocomplete(). |
| 300 content::SimulateMouseClick(contents, 0, WebKit::WebMouseEvent::ButtonLeft); | 300 content::SimulateMouseClick(contents, 0, WebKit::WebMouseEvent::ButtonLeft); |
| 301 ExpectDomMessage("clicked"); | 301 ExpectDomMessage("clicked"); |
| 302 | 302 |
| 303 AutofillDialogControllerImpl* controller = | 303 AutofillDialogControllerImpl* controller = |
| 304 delegate->GetDialogControllerForTesting(); | 304 static_cast<AutofillDialogControllerImpl*>( |
| 305 delegate->GetDialogControllerForTesting()); |
| 305 DCHECK(controller); | 306 DCHECK(controller); |
| 306 return controller; | 307 return controller; |
| 307 } | 308 } |
| 308 | 309 |
| 309 // Wait for a message from the DOM automation controller (from JS in the | 310 // Wait for a message from the DOM automation controller (from JS in the |
| 310 // page). Requires |SetUpHtmlAndInvoke()| be called first. | 311 // page). Requires |SetUpHtmlAndInvoke()| be called first. |
| 311 void ExpectDomMessage(const std::string& expected) { | 312 void ExpectDomMessage(const std::string& expected) { |
| 312 std::string message; | 313 std::string message; |
| 313 ASSERT_TRUE(dom_message_queue_->WaitForMessage(&message)); | 314 ASSERT_TRUE(dom_message_queue_->WaitForMessage(&message)); |
| 314 dom_message_queue_->ClearQueue(); | 315 dom_message_queue_->ClearQueue(); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 EXPECT_EQ(cc_number.type, new_cc_number.type); | 884 EXPECT_EQ(cc_number.type, new_cc_number.type); |
| 884 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), | 885 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), |
| 885 view->GetTextContentsOfInput(new_cc_number)); | 886 view->GetTextContentsOfInput(new_cc_number)); |
| 886 | 887 |
| 887 EXPECT_NE(ASCIIToUTF16("shipping name"), | 888 EXPECT_NE(ASCIIToUTF16("shipping name"), |
| 888 view->GetTextContentsOfInput(shipping_zip)); | 889 view->GetTextContentsOfInput(shipping_zip)); |
| 889 } | 890 } |
| 890 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 891 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
| 891 | 892 |
| 892 } // namespace autofill | 893 } // namespace autofill |
| OLD | NEW |