Index: Source/web/tests/WebViewTest.cpp |
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp |
index b55bf1b2397eb197baad8d6adeb39ced62ac7e85..09bb6cf9ae2bf034e69f6073646b682f9d9ba722 100644 |
--- a/Source/web/tests/WebViewTest.cpp |
+++ b/Source/web/tests/WebViewTest.cpp |
@@ -185,6 +185,38 @@ protected: |
std::string m_baseURL; |
}; |
+TEST_F(WebViewTest, SetBaseBackgroundColor) |
+{ |
+ const WebColor kWhite = 0xFFFFFFFF; |
+ const WebColor kBlue = 0xFF0000FF; |
+ const WebColor kDarkCyan = 0xFF227788; |
+ const WebColor kTranslucentPutty = 0x80BFB196; |
+ |
+ WebView* webView = FrameTestHelpers::createWebView(); |
+ EXPECT_EQ(kWhite, webView->backgroundColor()); |
+ |
+ webView->setBaseBackgroundColor(kBlue); |
+ EXPECT_EQ(kBlue, webView->backgroundColor()); |
+ |
+ WebURL baseURL = URLTestHelpers::toKURL("http://example.com/"); |
+ webView->mainFrame()->loadHTMLString( |
+ "<html><head><style>body {background-color:#227788}</style></head></html>", baseURL); |
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
+ EXPECT_EQ(kDarkCyan, webView->backgroundColor()); |
+ |
+ webView->mainFrame()->loadHTMLString( |
+ "<html><head><style>body {background-color:rgba(255,0,0,0.5)}</style></head></html>", baseURL); |
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
+ // Expected: red (50% alpha) blended atop base of kBlue. |
+ EXPECT_EQ(0xFF7F0080, webView->backgroundColor()); |
+ |
+ webView->setBaseBackgroundColor(kTranslucentPutty); |
+ // Expected: red (50% alpha) blended atop kTranslucentPutty. Note the alpha. |
+ EXPECT_EQ(0xBFE93B32, webView->backgroundColor()); |
+ |
+ webView->close(); |
+} |
+ |
TEST_F(WebViewTest, FocusIsInactive) |
{ |
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); |