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

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

Issue 870933002: Make it possible to set the display mode from the WebView API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Using enum now Created 5 years, 11 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 | « Source/web/WebViewImpl.cpp ('k') | public/platform/WebDisplayMode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebViewTest.cpp
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
index 965da847584b76052c626f47ee3dce7ecd36137d..38911ded4ac98724cedb9e412d732fba2e08f60c 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -54,6 +54,7 @@
#include "platform/graphics/Color.h"
#include "public/platform/Platform.h"
#include "public/platform/WebClipboard.h"
+#include "public/platform/WebDisplayMode.h"
#include "public/platform/WebDragData.h"
#include "public/platform/WebSize.h"
#include "public/platform/WebThread.h"
@@ -1701,6 +1702,22 @@ WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent,
return TestWebFrameClient::createChildFrame(parent, frameName, sandboxFlags);
}
+TEST_F(WebViewTest, ChangeDisplayMode)
+{
+ WebView* webView = m_webViewHelper.initializeAndLoad("about:blank", true);
+
+ WebScriptSource source("document.querySelector('body').innerHTML = window.matchMedia('(display-mode: minimal-ui)').matches");
+
+ webView->mainFrame()->executeScript(source);
+ std::string content = webView->mainFrame()->contentAsText(5).utf8();
+ EXPECT_EQ("false", content);
+
+ webView->setDisplayMode(WebDisplayModeMinimalUi);
+ webView->mainFrame()->executeScript(source);
+ content = webView->mainFrame()->contentAsText(5).utf8();
+ EXPECT_EQ("true", content);
+}
+
TEST_F(WebViewTest, AddFrameInCloseUnload)
{
CreateChildCounterFrameClient frameClient;
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | public/platform/WebDisplayMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698