Commit 42c0e8f4 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Adds a test: RoundedOmniboxPopupContentsViewTest.PopupMatchesLocationBarBackground

Follow-up to r546408.

Bug: 801583
Change-Id: I76d52b43a103e13054dc9286c9566da40e366661
Reviewed-on: https://chromium-review.googlesource.com/983085
Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547680}
parent 7dbfeb63
...@@ -444,6 +444,36 @@ IN_PROC_BROWSER_TEST_P(RoundedOmniboxPopupContentsViewTest, ...@@ -444,6 +444,36 @@ IN_PROC_BROWSER_TEST_P(RoundedOmniboxPopupContentsViewTest,
EXPECT_TRUE(GetPopupWidget()->IsClosed()); EXPECT_TRUE(GetPopupWidget()->IsClosed());
} }
// Check that, for the rounded popup, the location bar background (and the
// background of the textfield it contains) changes when the popup opens, and
// matches the popup background color.
IN_PROC_BROWSER_TEST_P(RoundedOmniboxPopupContentsViewTest,
PopupMatchesLocationBarBackground) {
const SkColor color_before_open = location_bar()->background()->get_color();
EXPECT_EQ(color_before_open, omnibox_view()->GetBackgroundColor());
CreatePopupForTestQuery();
const SkColor color_after_open = location_bar()->background()->get_color();
// Sanity check that the colors are different, otherwise this test will not be
// testing anything useful. It is possible that a particular theme could
// configure these colors to be the same. In that case, this test should be
// updated to detect that, or switch to a theme where they are different.
EXPECT_NE(color_before_open, color_after_open);
EXPECT_EQ(color_after_open, omnibox_view()->GetBackgroundColor());
// For the rounded popup, the background is hosted in the view that contains
// the results area.
views::View* background_host = popup_view()->parent();
EXPECT_EQ(color_after_open, background_host->background()->get_color());
// Closing the popup should restore the original colors.
edit_model()->StopAutocomplete();
EXPECT_EQ(color_before_open, location_bar()->background()->get_color());
EXPECT_EQ(color_before_open, omnibox_view()->GetBackgroundColor());
}
INSTANTIATE_TEST_CASE_P(, INSTANTIATE_TEST_CASE_P(,
OmniboxPopupContentsViewTest, OmniboxPopupContentsViewTest,
::testing::Values(WIDE, NARROW, ROUNDED), ::testing::Values(WIDE, NARROW, ROUNDED),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment