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

Unified Diff: chrome/browser/ui/browser_unittest.cc

Issue 2737553004: Set background color when adding a new tab. (Closed)
Patch Set: none Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..62bcd3212b0b889993957b1e7d6594bb327a2aba 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,27 @@ 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);
+
+ 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();
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698