Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_popup_model_unittest.cc

Issue 1082833006: Compute the correct maximum contents width when eliding away the description in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug and test Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_popup_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_popup_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698