Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "chrome/browser/ui/autofill/autofill_popup_layout_model.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 | 80 |
| 81 AutofillPopupLayoutModel* layout_model() { return layout_model_.get(); } | 81 AutofillPopupLayoutModel* layout_model() { return layout_model_.get(); } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 std::unique_ptr<TestAutofillPopupViewDelegate> delegate_; | 84 std::unique_ptr<TestAutofillPopupViewDelegate> delegate_; |
| 85 std::unique_ptr<AutofillPopupLayoutModel> layout_model_; | 85 std::unique_ptr<AutofillPopupLayoutModel> layout_model_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 #if !defined(OS_ANDROID) | 90 #if !defined(OS_ANDROID) |
|
Evan Stade
2017/07/12 17:53:52
hmm, why do we even compile this file on android?
melandory
2017/07/12 23:13:47
Done.
| |
| 91 TEST_F(AutofillPopupLayoutModelTest, RowWidthWithoutText) { | 91 TEST_F(AutofillPopupLayoutModelTest, RowWidthWithoutText) { |
| 92 int base_size = | 92 int base_size = |
| 93 AutofillPopupLayoutModel::kEndPadding * 2 + kPopupBorderThickness * 2; | 93 AutofillPopupLayoutModel::kEndPadding * 2 + kPopupBorderThickness * 2; |
| 94 int subtext_increase = AutofillPopupLayoutModel::kNamePadding; | 94 int subtext_increase = AutofillPopupLayoutModel::kNamePadding; |
| 95 | 95 |
| 96 // Refer to GetSuggestions() in TestAutofillPopupViewDelegate. | 96 // Refer to GetSuggestions() in TestAutofillPopupViewDelegate. |
| 97 EXPECT_EQ(base_size, | 97 EXPECT_EQ(base_size, |
| 98 layout_model()->RowWidthWithoutText(0, /* with_label= */ false)); | 98 layout_model()->RowWidthWithoutText(0, /* with_label= */ false)); |
| 99 EXPECT_EQ(base_size + subtext_increase, | 99 EXPECT_EQ(base_size + subtext_increase, |
| 100 layout_model()->RowWidthWithoutText(1, /* with_label= */ true)); | 100 layout_model()->RowWidthWithoutText(1, /* with_label= */ true)); |
| 101 EXPECT_EQ(base_size + AutofillPopupLayoutModel::kIconPadding + | 101 EXPECT_EQ(base_size + AutofillPopupLayoutModel::kIconPadding + |
| 102 ui::ResourceBundle::GetSharedInstance() | 102 ui::ResourceBundle::GetSharedInstance() |
| 103 .GetImageNamed(IDR_AUTOFILL_CC_AMEX) | 103 .GetImageNamed(IDR_AUTOFILL_CC_AMEX) |
| 104 .Width(), | 104 .Width(), |
| 105 layout_model()->RowWidthWithoutText(2, /* with_label= */ false)); | 105 layout_model()->RowWidthWithoutText(2, /* with_label= */ false)); |
| 106 EXPECT_EQ(base_size + subtext_increase + | 106 EXPECT_EQ(base_size + subtext_increase + |
| 107 AutofillPopupLayoutModel::kIconPadding + | 107 AutofillPopupLayoutModel::kIconPadding + |
| 108 ui::ResourceBundle::GetSharedInstance() | 108 ui::ResourceBundle::GetSharedInstance() |
| 109 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) | 109 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) |
| 110 .Width(), | 110 .Width(), |
| 111 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); | 111 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); |
| 112 EXPECT_EQ(base_size + AutofillPopupLayoutModel::kHttpWarningNamePadding + | 112 EXPECT_EQ(base_size + AutofillPopupLayoutModel::kHttpWarningNamePadding + |
| 113 AutofillPopupLayoutModel::kHttpWarningIconPadding + | 113 AutofillPopupLayoutModel::kPaddingBetweenLeftSideIconAndText + |
| 114 layout_model()->GetIconImage(4).width(), | 114 layout_model()->GetIconImage(4).width(), |
| 115 layout_model()->RowWidthWithoutText(4, /* with_label= */ true)); | 115 layout_model()->RowWidthWithoutText(4, /* with_label= */ true)); |
| 116 } | 116 } |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 } // namespace autofill | 119 } // namespace autofill |
| OLD | NEW |