Commit 83f06db5 authored by loislo@chromium.org's avatar loislo@chromium.org

DevTools: fix for test inspector-protocol/page/enable-disable.html

BUG=316349

Review URL: https://codereview.chromium.org/340803002

git-svn-id: svn://svn.chromium.org/blink/trunk@176447 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5a455eb5
......@@ -739,8 +739,6 @@ crbug.com/313846 http/tests/images/webp-partial-load.html [ ImageOnlyFailure Tim
crbug.com/316150 inspector/timeline/timeline-network-received-data.html [ Failure Pass ]
crbug.com/316349 inspector-protocol/page/enable-disable.html [ Failure Pass ]
crbug.com/316730 canvas/synchronous-create-pattern.html [ ImageOnlyFailure Pass ]
crbug.com/320099 webaudio/oscillator-sawtooth.html [ NeedsManualRebaseline ]
......
......@@ -31,8 +31,14 @@ InspectorFrontendAPI = {};
InspectorTest = {};
InspectorTest._dispatchTable = [];
InspectorTest._requestId = -1;
InspectorTest._dumpInspectorProtocolMessages = false;
InspectorTest.eventHandler = {};
InspectorTest.startDumpingProtocolMessages = function()
{
InspectorTest._dumpInspectorProtocolMessages = true;
}
/**
* @param {string} method
* @param {object} params
......@@ -46,6 +52,8 @@ InspectorTest.sendCommand = function(method, params, handler)
"params": params,
"id": this._requestId };
if (InspectorTest._dumpInspectorProtocolMessages)
testRunner.logToStderr("backend: " + JSON.stringify(messageObject));
InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
return this._requestId;
......@@ -132,6 +140,8 @@ InspectorTest.sendRawCommand = function(command, handler)
*/
InspectorFrontendAPI.dispatchMessage = function(message)
{
if (InspectorTest._dumpInspectorProtocolMessages)
testRunner.logToStderr("frontend: " + message);
var messageObject = JSON.parse(message);
var messageId = messageObject["id"];
try {
......
Timeline started
Page enabled
Timeline.eventRecorded: FunctionCall
Page disabled
Timeline stopped
......@@ -5,30 +5,56 @@
function test()
{
var log = [];
InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded;
InspectorTest.sendCommand("Timeline.start", {});
InspectorTest.sendCommand("Page.enable", {}, pageEnabled);
InspectorTest.sendCommand("Timeline.start", {}, timelineStarted);
function pageEnabled()
function timelineStarted()
{
InspectorTest.log("Page enabled");
InspectorTest.sendCommand("Page.disable", {});
InspectorTest.sendCommand("Timeline.stop", {}, pageDisabled);
log.push("Timeline started");
InspectorTest.sendCommand("Page.enable", {}, pageAgentEnabled);
}
function pageDisabled()
function pageAgentEnabled()
{
InspectorTest.log("Page disabled");
log.push("Page enabled");
InspectorTest.sendCommand("Page.disable", {}, pageAgentDisabled);
}
function pageAgentDisabled()
{
log.push("Page disabled");
InspectorTest.sendCommand("NotExistingCommand", {}, didRoundTripOverProtocol);
}
function didRoundTripOverProtocol()
{
InspectorTest.sendCommand("Timeline.stop", {}, timelineStopped);
}
function timelineStopped(next)
{
log.push("Timeline stopped");
for (var i = 0; i < log.length; ++i)
InspectorTest.log(log[i]);
InspectorTest.completeTest();
}
function eventRecorded(msg)
{
var type = msg.params.record.type;
if (type.indexOf("GC") !== -1)
if (msg.params.record.type === "Program") {
var children = msg.params.record.children;
for (var i = 0; i < children.length; ++i) {
var record = children[i];
if (record.type === "GCEvent")
continue;
log.push("Timeline.eventRecorded: " + record.type);
}
return;
InspectorTest.log("Timeline.eventRecorded: " + type);
}
InspectorTest.log("FAIL: Unexpected records arrived");
InspectorTest.logObject(msg);
}
}
......
......@@ -421,7 +421,8 @@ void InspectorPageAgent::disable(ErrorString*)
setShowDebugBorders(0, false);
setShowFPSCounter(0, false);
setEmulatedMedia(0, String());
setContinuousPaintingEnabled(0, false);
if (m_state->getBoolean(PageAgentState::pageAgentContinuousPaintingEnabled))
setContinuousPaintingEnabled(0, false);
setShowScrollBottleneckRects(0, false);
setShowViewportSizeOnResize(0, false, 0);
......@@ -739,13 +740,20 @@ bool InspectorPageAgent::deviceMetricsChanged(bool enabled, int width, int heigh
// These two always fit an int.
int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 1);
double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 0);
bool currentEmulateViewport = m_state->getBoolean(PageAgentState::pageAgentEmulateViewport);
bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScaleFactor, 1);
bool currentTextAutosizing = m_state->getBoolean(PageAgentState::pageAgentTextAutosizingOverride);
return enabled != currentEnabled || width != currentWidth || height != currentHeight || deviceScaleFactor != currentDeviceScaleFactor || emulateViewport != currentEmulateViewport || fitWindow != currentFitWindow || fontScaleFactor != currentFontScaleFactor || textAutosizing != currentTextAutosizing;
return enabled != currentEnabled
|| width != currentWidth
|| height != currentHeight
|| deviceScaleFactor != currentDeviceScaleFactor
|| emulateViewport != currentEmulateViewport
|| fitWindow != currentFitWindow
|| fontScaleFactor != currentFontScaleFactor
|| textAutosizing != currentTextAutosizing;
}
void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment