| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 autofill_popup_controller_->SetValues(suggestions); | 438 autofill_popup_controller_->SetValues(suggestions); |
| 439 | 439 |
| 440 // Ensure the popup will be too small to display all of the first row. | 440 // Ensure the popup will be too small to display all of the first row. |
| 441 int popup_max_width = | 441 int popup_max_width = |
| 442 gfx::GetStringWidth( | 442 gfx::GetStringWidth( |
| 443 suggestions[0].value, | 443 suggestions[0].value, |
| 444 autofill_popup_controller_->layout_model().GetValueFontListForRow( | 444 autofill_popup_controller_->layout_model().GetValueFontListForRow( |
| 445 0)) + | 445 0)) + |
| 446 gfx::GetStringWidth( | 446 gfx::GetStringWidth( |
| 447 suggestions[0].label, | 447 suggestions[0].label, |
| 448 autofill_popup_controller_->layout_model().GetLabelFontList()) - | 448 autofill_popup_controller_->layout_model().GetLabelFontListForRow( |
| 449 0)) - |
| 449 25; | 450 25; |
| 450 | 451 |
| 451 autofill_popup_controller_->ElideValueAndLabelForRow(0, popup_max_width); | 452 autofill_popup_controller_->ElideValueAndLabelForRow(0, popup_max_width); |
| 452 | 453 |
| 453 // The first element was long so it should have been trimmed. | 454 // The first element was long so it should have been trimmed. |
| 454 EXPECT_NE(autofill_popup_controller_->GetSuggestionAt(0).value, | 455 EXPECT_NE(autofill_popup_controller_->GetSuggestionAt(0).value, |
| 455 autofill_popup_controller_->GetElidedValueAt(0)); | 456 autofill_popup_controller_->GetElidedValueAt(0)); |
| 456 EXPECT_NE(autofill_popup_controller_->GetSuggestionAt(0).label, | 457 EXPECT_NE(autofill_popup_controller_->GetSuggestionAt(0).label, |
| 457 autofill_popup_controller_->GetElidedLabelAt(0)); | 458 autofill_popup_controller_->GetElidedLabelAt(0)); |
| 458 | 459 |
| 459 autofill_popup_controller_->ElideValueAndLabelForRow(1, popup_max_width); | 460 autofill_popup_controller_->ElideValueAndLabelForRow(1, popup_max_width); |
| 460 | 461 |
| 461 // The second element was shorter so it should be unchanged. | 462 // The second element was shorter so it should be unchanged. |
| 462 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).value, | 463 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).value, |
| 463 autofill_popup_controller_->GetElidedValueAt(1)); | 464 autofill_popup_controller_->GetElidedValueAt(1)); |
| 464 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).label, | 465 EXPECT_EQ(autofill_popup_controller_->GetSuggestionAt(1).label, |
| 465 autofill_popup_controller_->GetElidedLabelAt(1)); | 466 autofill_popup_controller_->GetElidedLabelAt(1)); |
| 466 } | 467 } |
| 467 #endif | 468 #endif |
| 468 | 469 |
| 469 } // namespace autofill | 470 } // namespace autofill |
| OLD | NEW |