| 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 scoped_ptr<PrefService> prefs_; | 67 scoped_ptr<PrefService> prefs_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); | 69 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class TestAutofillPopupController : public AutofillPopupControllerImpl { | 72 class TestAutofillPopupController : public AutofillPopupControllerImpl { |
| 73 public: | 73 public: |
| 74 explicit TestAutofillPopupController( | 74 explicit TestAutofillPopupController( |
| 75 base::WeakPtr<AutofillExternalDelegate> external_delegate, | 75 base::WeakPtr<AutofillExternalDelegate> external_delegate, |
| 76 const gfx::RectF& element_bounds) | 76 const gfx::RectF& element_bounds) |
| 77 : AutofillPopupControllerImpl( | 77 : AutofillPopupControllerImpl(external_delegate, |
| 78 external_delegate, NULL, NULL, element_bounds, | 78 NULL, |
| 79 base::i18n::UNKNOWN_DIRECTION), | 79 NULL, |
| 80 test_controller_common_(new TestPopupControllerCommon(element_bounds)) { | 80 element_bounds, |
| 81 base::i18n::UNKNOWN_DIRECTION), |
| 82 test_controller_common_( |
| 83 new TestPopupControllerCommon(element_bounds, |
| 84 base::i18n::LEFT_TO_RIGHT)) { |
| 81 controller_common_.reset(test_controller_common_); | 85 controller_common_.reset(test_controller_common_); |
| 82 } | 86 } |
| 83 ~TestAutofillPopupController() override {} | 87 ~TestAutofillPopupController() override {} |
| 84 | 88 |
| 85 void set_display(const gfx::Display& display) { | 89 void set_display(const gfx::Display& display) { |
| 86 test_controller_common_->set_display(display); | 90 test_controller_common_->set_display(display); |
| 87 } | 91 } |
| 88 | 92 |
| 89 // Making protected functions public for testing | 93 // Making protected functions public for testing |
| 90 using AutofillPopupControllerImpl::SetPopupBounds; | 94 using AutofillPopupControllerImpl::SetPopupBounds; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 528 |
| 525 // The second element was shorter so it should be unchanged. | 529 // The second element was shorter so it should be unchanged. |
| 526 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).value, | 530 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).value, |
| 527 autofill_popup_controller_->GetElidedValueAt(1)); | 531 autofill_popup_controller_->GetElidedValueAt(1)); |
| 528 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).label, | 532 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).label, |
| 529 autofill_popup_controller_->GetElidedLabelAt(1)); | 533 autofill_popup_controller_->GetElidedLabelAt(1)); |
| 530 } | 534 } |
| 531 #endif | 535 #endif |
| 532 | 536 |
| 533 } // namespace autofill | 537 } // namespace autofill |
| OLD | NEW |