This source file includes following definitions.
- TEST
#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(OmniboxResultViewTest, CheckComputeMatchWidths) {
int contents_max_width, description_max_width;
const int separator_width = 10;
OmniboxResultView::ComputeMatchMaxWidths(
100, separator_width, 50, 200, true, &contents_max_width,
&description_max_width);
EXPECT_EQ(-1, contents_max_width);
EXPECT_EQ(-1, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
100, separator_width, 50, 100, true, &contents_max_width,
&description_max_width);
EXPECT_EQ(-1, contents_max_width);
EXPECT_EQ(0, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
300, separator_width, 75, 384, true, &contents_max_width,
&description_max_width);
EXPECT_EQ(-1, contents_max_width);
EXPECT_EQ(0, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
310, separator_width, 150, 400, true, &contents_max_width,
&description_max_width);
EXPECT_EQ(300, contents_max_width);
EXPECT_EQ(400 - 300 - separator_width, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
400, separator_width, 0, 200, true, &contents_max_width,
&description_max_width);
EXPECT_EQ(-1, contents_max_width);
EXPECT_EQ(0, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
395, separator_width, 395, 700, true, &contents_max_width,
&description_max_width);
EXPECT_EQ((700 - separator_width) / 2, contents_max_width);
EXPECT_EQ((700 - separator_width) / 2, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
395, separator_width, 395, 700, false, &contents_max_width,
&description_max_width);
EXPECT_EQ(-1, contents_max_width);
EXPECT_EQ(295, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
395, separator_width, 395, 699, true, &contents_max_width,
&description_max_width);
EXPECT_EQ((700 - separator_width) / 2, contents_max_width);
EXPECT_EQ((700 - separator_width) / 2 - 1, description_max_width);
OmniboxResultView::ComputeMatchMaxWidths(
1, 1, 1, 0, true, &contents_max_width, &description_max_width);
EXPECT_EQ(0, contents_max_width);
EXPECT_EQ(0, description_max_width);
}