| 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 "base/memory/scoped_ptr.h" | 9 #include <memory> |
| 10 |
| 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 11 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | 12 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
| 12 #include "chrome/browser/ui/autofill/popup_constants.h" | 13 #include "chrome/browser/ui/autofill/popup_constants.h" |
| 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 14 #include "components/autofill/core/browser/suggestion.h" | 15 #include "components/autofill/core/browser/suggestion.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/components_scaled_resources.h" | 17 #include "grit/components_scaled_resources.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/geometry/point.h" | 20 #include "ui/gfx/geometry/point.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void SetUp() override { | 67 void SetUp() override { |
| 67 ChromeRenderViewHostTestHarness::SetUp(); | 68 ChromeRenderViewHostTestHarness::SetUp(); |
| 68 | 69 |
| 69 delegate_.reset(new TestAutofillPopupViewDelegate(web_contents())); | 70 delegate_.reset(new TestAutofillPopupViewDelegate(web_contents())); |
| 70 layout_model_.reset(new AutofillPopupLayoutModel(delegate_.get())); | 71 layout_model_.reset(new AutofillPopupLayoutModel(delegate_.get())); |
| 71 } | 72 } |
| 72 | 73 |
| 73 AutofillPopupLayoutModel* layout_model() { return layout_model_.get(); } | 74 AutofillPopupLayoutModel* layout_model() { return layout_model_.get(); } |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 scoped_ptr<TestAutofillPopupViewDelegate> delegate_; | 77 std::unique_ptr<TestAutofillPopupViewDelegate> delegate_; |
| 77 scoped_ptr<AutofillPopupLayoutModel> layout_model_; | 78 std::unique_ptr<AutofillPopupLayoutModel> layout_model_; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace | 81 } // namespace |
| 81 | 82 |
| 82 #if !defined(OS_ANDROID) | 83 #if !defined(OS_ANDROID) |
| 83 TEST_F(AutofillPopupLayoutModelTest, RowWidthWithoutText) { | 84 TEST_F(AutofillPopupLayoutModelTest, RowWidthWithoutText) { |
| 84 int base_size = | 85 int base_size = |
| 85 AutofillPopupLayoutModel::kEndPadding * 2 + kPopupBorderThickness * 2; | 86 AutofillPopupLayoutModel::kEndPadding * 2 + kPopupBorderThickness * 2; |
| 86 int subtext_increase = AutofillPopupLayoutModel::kNamePadding; | 87 int subtext_increase = AutofillPopupLayoutModel::kNamePadding; |
| 87 | 88 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 98 EXPECT_EQ(base_size + subtext_increase + | 99 EXPECT_EQ(base_size + subtext_increase + |
| 99 AutofillPopupLayoutModel::kIconPadding + | 100 AutofillPopupLayoutModel::kIconPadding + |
| 100 ui::ResourceBundle::GetSharedInstance() | 101 ui::ResourceBundle::GetSharedInstance() |
| 101 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) | 102 .GetImageNamed(IDR_AUTOFILL_CC_GENERIC) |
| 102 .Width(), | 103 .Width(), |
| 103 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); | 104 layout_model()->RowWidthWithoutText(3, /* with_label= */ true)); |
| 104 } | 105 } |
| 105 #endif | 106 #endif |
| 106 | 107 |
| 107 } // namespace autofill | 108 } // namespace autofill |
| OLD | NEW |