Chromium Code Reviews| Index: chrome/browser/ui/browser_unittest.cc |
| diff --git a/chrome/browser/ui/browser_unittest.cc b/chrome/browser/ui/browser_unittest.cc |
| index 6cfdf0b5f4eab9329772ffc1e20795fc77b523ae..fa7b360d9d006849ada32cc4cced92b9cb3bf1d9 100644 |
| --- a/chrome/browser/ui/browser_unittest.cc |
| +++ b/chrome/browser/ui/browser_unittest.cc |
| @@ -11,9 +11,11 @@ |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/test/base/browser_with_test_window_test.h" |
| #include "components/zoom/zoom_controller.h" |
| +#include "content/public/browser/render_widget_host_view.h" |
| #include "content/public/browser/site_instance.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/test/web_contents_tester.h" |
| +#include "third_party/skia/include/core/SkColor.h" |
| using content::SiteInstance; |
| using content::WebContents; |
| @@ -66,6 +68,31 @@ TEST_F(BrowserUnitTest, ReloadCrashedTab) { |
| EXPECT_TRUE(contents2->IsCrashed()); |
| } |
| +TEST_F(BrowserUnitTest, SetBackgroundColorForNewTab) { |
| + TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
| + |
| + WebContents* contents1 = CreateTestWebContents(); |
| + tab_strip_model->AppendWebContents(contents1, true); |
| + WebContentsTester::For(contents1)->NavigateAndCommit(GURL("about:blank")); |
| + WebContentsTester::For(contents1)->TestSetIsLoading(false); |
| + |
| + contents1->GetMainFrame()->GetView()->SetBackgroundColor(SK_ColorRED); |
| + |
| + // Add a second tab in the background. |
| + WebContents* contents2 = CreateTestWebContents(); |
| + tab_strip_model->AppendWebContents(contents2, false); |
| + WebContentsTester::For(contents2)->NavigateAndCommit(GURL("about:blank")); |
| + WebContentsTester::For(contents2)->TestSetIsLoading(false); |
| + |
| + // Color is only set once the tab is activated. |
|
Peter Kasting
2017/03/07 00:28:36
Why is it important to test this? It doesn't seem
chrishtr
2017/03/07 00:36:48
Fair point. Deleted this part.
|
| + EXPECT_FALSE(SK_ColorRED == |
| + contents2->GetMainFrame()->GetView()->background_color()); |
| + |
| + tab_strip_model->ActivateTabAt(1, true); |
| + EXPECT_EQ(SK_ColorRED, |
| + contents2->GetMainFrame()->GetView()->background_color()); |
| +} |
| + |
| // Ensure the print command gets disabled when a tab crashes. |
| TEST_F(BrowserUnitTest, DisablePrintOnCrashedTab) { |
| TabStripModel* tab_strip_model = browser()->tab_strip_model(); |