OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/omnibox/omnibox_popup_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 TEST(OmniboxPopupModelTest, ComputeMatchMaxWidths) { | 8 TEST(OmniboxPopupModelTest, ComputeMatchMaxWidths) { |
9 int contents_max_width, description_max_width; | 9 int contents_max_width, description_max_width; |
10 const int separator_width = 10; | 10 const int separator_width = 10; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 EXPECT_EQ(available_width - kMinimumContentsWidth - separator_width, | 56 EXPECT_EQ(available_width - kMinimumContentsWidth - separator_width, |
57 description_max_width); | 57 description_max_width); |
58 | 58 |
59 // Contents takes all available space. | 59 // Contents takes all available space. |
60 contents_width = 400; | 60 contents_width = 400; |
61 description_width = 0; | 61 description_width = 0; |
62 available_width = 200; | 62 available_width = 200; |
63 OmniboxPopupModel::ComputeMatchMaxWidths( | 63 OmniboxPopupModel::ComputeMatchMaxWidths( |
64 contents_width, separator_width, description_width, available_width, | 64 contents_width, separator_width, description_width, available_width, |
65 true, &contents_max_width, &description_max_width); | 65 true, &contents_max_width, &description_max_width); |
66 EXPECT_EQ(contents_width, contents_max_width); | 66 EXPECT_EQ(available_width, contents_max_width); |
67 EXPECT_EQ(0, description_max_width); | 67 EXPECT_EQ(0, description_max_width); |
68 | 68 |
69 // Half and half. | 69 // Half and half. |
70 contents_width = 395; | 70 contents_width = 395; |
71 description_width = 395; | 71 description_width = 395; |
72 available_width = 700; | 72 available_width = 700; |
73 OmniboxPopupModel::ComputeMatchMaxWidths( | 73 OmniboxPopupModel::ComputeMatchMaxWidths( |
74 contents_width, separator_width, description_width, available_width, | 74 contents_width, separator_width, description_width, available_width, |
75 true, &contents_max_width, &description_max_width); | 75 true, &contents_max_width, &description_max_width); |
76 EXPECT_EQ(345, contents_max_width); | 76 EXPECT_EQ(345, contents_max_width); |
(...skipping 26 matching lines...) Expand all Loading... |
103 contents_width = 1; | 103 contents_width = 1; |
104 description_width = 1; | 104 description_width = 1; |
105 available_width = 0; | 105 available_width = 0; |
106 OmniboxPopupModel::ComputeMatchMaxWidths( | 106 OmniboxPopupModel::ComputeMatchMaxWidths( |
107 contents_width, separator_width, description_width, available_width, | 107 contents_width, separator_width, description_width, available_width, |
108 true, &contents_max_width, &description_max_width); | 108 true, &contents_max_width, &description_max_width); |
109 EXPECT_EQ(0, contents_max_width); | 109 EXPECT_EQ(0, contents_max_width); |
110 EXPECT_EQ(0, description_max_width); | 110 EXPECT_EQ(0, description_max_width); |
111 } | 111 } |
112 | 112 |
OLD | NEW |