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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 329943004: Implementation of brand-color (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add RuntimeEnabledFeatures Created 6 years, 6 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
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index b0fdef8e6bd66b00cd63cdd97ed88eed4ba6fd7b..aa97516135ea5ad371359b2e32cefbc427ffed72 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5540,4 +5540,44 @@ TEST_F(WebFrameTest, NodeImageTestCSS3DTransform)
EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSize()));
}
+class BrandColorTestWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
+public:
+ BrandColorTestWebFrameClient()
+ : m_didNotify(false)
+ , m_brandColor(0)
+ {
+ }
+
+ bool didNotify() const
+ {
+ return m_didNotify;
+ }
+
+ WebColor brandColor() const
+ {
+ return m_brandColor;
+ }
+
+private:
+ virtual void didChangeBrandColor(WebLocalFrame* webLocalFrame)
+ {
+ m_didNotify = true;
+ m_brandColor = webLocalFrame->document().brandColor();
+ }
+
+ bool m_didNotify;
+ WebColor m_brandColor;
+};
+
+TEST_F(WebFrameTest, BrandColor)
+{
+ registerMockedHttpURLLoad("brand_color_test.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ BrandColorTestWebFrameClient client;
+ WebCore::RuntimeEnabledFeatures::setBrandColorEnabled(true);
+ webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client);
+ EXPECT_TRUE(client.didNotify());
+ EXPECT_EQ(0xff0000ff, client.brandColor());
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698