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

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

Issue 1343843004: [DevTools] Emulate hover and pointer types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed settings getters Created 5 years, 3 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/WebSettingsImpl.cpp ('k') | Source/web/tests/data/device_emulation.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 2ea914dcf633bdbefd3dd7fec1a736ce30f1fb0a..d9bcd7f3116b98c34acf4109b395b5e80b140aa4 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7763,14 +7763,14 @@ TEST_P(ParameterizedWebFrameTest, CrossDomainAccessErrorsUseCallingWindow)
popupWebViewHelper.reset();
}
-class ViewportOnResizeTest : public ParameterizedWebFrameTest {
+class DeviceEmulationTest : public ParameterizedWebFrameTest {
protected:
- ViewportOnResizeTest()
+ DeviceEmulationTest()
: m_webViewHelper(this)
{
- registerMockedHttpURLLoad("viewport_emulation.html");
+ registerMockedHttpURLLoad("device_emulation.html");
m_client.m_screenInfo.deviceScaleFactor = 1;
- m_webViewHelper.initializeAndLoad(m_baseURL + "viewport_emulation.html", true, 0, &m_client);
+ m_webViewHelper.initializeAndLoad(m_baseURL + "device_emulation.html", true, 0, &m_client);
}
void testResize(const WebSize size, const String& expectedSize)
@@ -7779,24 +7779,29 @@ protected:
m_client.m_screenInfo.availableRect = m_client.m_screenInfo.rect;
m_webViewHelper.webView()->resize(size);
m_webViewHelper.webView()->layout();
+ EXPECT_EQ(expectedSize, dumpSize("test"));
+ }
+ String dumpSize(const String& id)
+ {
+ String code = "dumpSize('" + id + "')";
v8::HandleScope scope(v8::Isolate::GetCurrent());
ScriptExecutionCallbackHelper callbackHelper(m_webViewHelper.webView()->mainFrame()->mainWorldScriptContext());
- m_webViewHelper.webView()->mainFrame()->toWebLocalFrame()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString("dumpSize()")), false, &callbackHelper);
+ m_webViewHelper.webView()->mainFrame()->toWebLocalFrame()->requestExecuteScriptAndReturnValue(WebScriptSource(WebString(code)), false, &callbackHelper);
runPendingTasks();
EXPECT_TRUE(callbackHelper.didComplete());
- EXPECT_EQ(expectedSize, callbackHelper.stringValue());
+ return callbackHelper.stringValue();
}
FixedLayoutTestWebViewClient m_client;
FrameTestHelpers::WebViewHelper m_webViewHelper;
};
-INSTANTIATE_TEST_CASE_P(All, ViewportOnResizeTest, ::testing::Values(
+INSTANTIATE_TEST_CASE_P(All, DeviceEmulationTest, ::testing::Values(
ParameterizedWebFrameTestConfig::Default,
ParameterizedWebFrameTestConfig::RootLayerScrolls));
-TEST_P(ViewportOnResizeTest, ViewportInvalidatedOnResizeWithEmulation)
+TEST_P(DeviceEmulationTest, DeviceSizeInvalidatedOnResize)
{
WebDeviceEmulationParams params;
params.screenPosition = WebDeviceEmulationParams::Mobile;
@@ -7814,6 +7819,15 @@ TEST_P(ViewportOnResizeTest, ViewportInvalidatedOnResizeWithEmulation)
m_webViewHelper.webView()->disableDeviceEmulation();
}
+TEST_P(DeviceEmulationTest, PointerAndHoverTypes)
+{
+ WebDeviceEmulationParams params;
+ params.screenPosition = WebDeviceEmulationParams::Mobile;
+ m_webViewHelper.webView()->enableDeviceEmulation(params);
+ EXPECT_EQ("20x20", dumpSize("pointer"));
+ m_webViewHelper.webView()->disableDeviceEmulation();
+}
+
class WebLocalFrameScope final {
public:
WebLocalFrameScope(WebLocalFrame* localFrame)
« no previous file with comments | « Source/web/WebSettingsImpl.cpp ('k') | Source/web/tests/data/device_emulation.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698