Commit bdef4391 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: introduce experimental domain for Testing-related methods.

Change-Id: I1f6ae07e64193ee328ecc4ecd16f5c17e8447808
Reviewed-on: https://chromium-review.googlesource.com/1188687
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586438}
parent 3079ba7d
Tests that generated agent prototypes match with domains returned by schema.getDomains.
domain Browser is missing from schema.getDomains
domain SystemInfo is missing from schema.getDomains
domain Tethering is missing from schema.getDomains
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(`Tests that generated agent prototypes match with domains returned by schema.getDomains.\n`);
var target = TestRunner.mainTarget;
var domains = await target.schemaAgent().getDomains();
if (!domains) {
TestRunner.addResult('error getting domains');
TestRunner.completeTest();
return;
}
var domainNames = domains.map(domain => domain.name).sort();
var agentNames = Object.keys(target._agents).sort();
for (var domain of domainNames) {
if (agentNames.indexOf(domain) === -1)
TestRunner.addResult('agent ' + domain + ' is missing from target');
}
for (var agent of agentNames) {
if (domainNames.indexOf(agent) === -1)
TestRunner.addResult('domain ' + agent + ' is missing from schema.getDomains');
}
TestRunner.completeTest();
})();
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
#include "third_party/blink/renderer/core/inspector/inspector_resource_content_loader.h" #include "third_party/blink/renderer/core/inspector/inspector_resource_content_loader.h"
#include "third_party/blink/renderer/core/inspector/inspector_session.h" #include "third_party/blink/renderer/core/inspector/inspector_session.h"
#include "third_party/blink/renderer/core/inspector/inspector_task_runner.h" #include "third_party/blink/renderer/core/inspector/inspector_task_runner.h"
#include "third_party/blink/renderer/core/inspector/inspector_testing_agent.h"
#include "third_party/blink/renderer/core/inspector/inspector_worker_agent.h" #include "third_party/blink/renderer/core/inspector/inspector_worker_agent.h"
#include "third_party/blink/renderer/core/inspector/main_thread_debugger.h" #include "third_party/blink/renderer/core/inspector/main_thread_debugger.h"
#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/layout_view.h"
...@@ -470,6 +471,8 @@ void WebDevToolsAgentImpl::Session::InitializeInspectorSession( ...@@ -470,6 +471,8 @@ void WebDevToolsAgentImpl::Session::InitializeInspectorSession(
// we have to store the frame which will become the main frame later. // we have to store the frame which will become the main frame later.
inspector_session_->Append(new InspectorEmulationAgent(frame_.Get())); inspector_session_->Append(new InspectorEmulationAgent(frame_.Get()));
inspector_session_->Append(new InspectorTestingAgent(inspected_frames));
// Call session init callbacks registered from higher layers // Call session init callbacks registered from higher layers
CoreInitializer::GetInstance().InitInspectorAgentSession( CoreInitializer::GetInstance().InitInspectorAgentSession(
inspector_session_, agent_->include_view_agents_, dom_agent, inspector_session_, agent_->include_view_agents_, dom_agent,
......
...@@ -83,6 +83,8 @@ blink_core_sources("inspector") { ...@@ -83,6 +83,8 @@ blink_core_sources("inspector") {
"inspector_style_sheet.h", "inspector_style_sheet.h",
"inspector_task_runner.cc", "inspector_task_runner.cc",
"inspector_task_runner.h", "inspector_task_runner.h",
"inspector_testing_agent.cc",
"inspector_testing_agent.h",
"inspector_trace_events.cc", "inspector_trace_events.cc",
"inspector_trace_events.h", "inspector_trace_events.h",
"inspector_worker_agent.cc", "inspector_worker_agent.cc",
...@@ -175,6 +177,8 @@ inspector_protocol_generate("protocol_sources") { ...@@ -175,6 +177,8 @@ inspector_protocol_generate("protocol_sources") {
"inspector/protocol/Security.h", "inspector/protocol/Security.h",
"inspector/protocol/Target.cpp", "inspector/protocol/Target.cpp",
"inspector/protocol/Target.h", "inspector/protocol/Target.h",
"inspector/protocol/Testing.cpp",
"inspector/protocol/Testing.h",
] ]
deps = [ deps = [
......
...@@ -6185,3 +6185,16 @@ experimental domain Tracing ...@@ -6185,3 +6185,16 @@ experimental domain Tracing
optional IO.StreamHandle stream optional IO.StreamHandle stream
# Compression format of returned stream. # Compression format of returned stream.
optional StreamCompression streamCompression optional StreamCompression streamCompression
# Testing domain is a dumping ground for the capabilities requires for browser or app testing that do not fit other
# domains.
experimental domain Testing
depends on Page
# Generates a report for testing.
command generateTestReport
parameters
# Message to be displayed in the report.
string message
# Specifies the endpoint group to deliver the report to.
optional string group
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
"domain": "Target", "domain": "Target",
"include": ["setAutoAttach", "sendMessageToTarget"], "include": ["setAutoAttach", "sendMessageToTarget"],
"include_events": ["attachedToTarget", "detachedFromTarget", "receivedMessageFromTarget"] "include_events": ["attachedToTarget", "detachedFromTarget", "receivedMessageFromTarget"]
},
{
"domain": "Testing"
} }
] ]
}, },
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/inspector/inspector_testing_agent.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
namespace blink {
InspectorTestingAgent::InspectorTestingAgent(InspectedFrames* inspected_frames)
: inspected_frames_(inspected_frames) {}
InspectorTestingAgent::~InspectorTestingAgent() = default;
void InspectorTestingAgent::Trace(blink::Visitor* visitor) {
visitor->Trace(inspected_frames_);
InspectorBaseAgent::Trace(visitor);
}
protocol::Response InspectorTestingAgent::generateTestReport(
const String& message,
protocol::Maybe<String> group) {
return protocol::Response::OK();
}
} // namespace blink
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_TESTING_AGENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_TESTING_AGENT_H_
#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/inspector/inspector_base_agent.h"
#include "third_party/blink/renderer/core/inspector/protocol/Testing.h"
namespace blink {
class InspectedFrames;
class CORE_EXPORT InspectorTestingAgent final
: public InspectorBaseAgent<protocol::Testing::Metainfo> {
public:
InspectorTestingAgent(InspectedFrames*);
~InspectorTestingAgent() override;
void Trace(blink::Visitor*) override;
protocol::Response generateTestReport(const String& message,
protocol::Maybe<String> group) override;
private:
Member<InspectedFrames> inspected_frames_;
DISALLOW_COPY_AND_ASSIGN(InspectorTestingAgent);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_TESTING_AGENT_H_
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