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

Unified Diff: components/test_runner/test_runner.cc

Issue 2338623004: Add Blink setting to block doc.written scripts on 2g-like networks (Closed)
Patch Set: Update test results after rebase Created 4 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 | « components/test_runner/test_runner.h ('k') | components/test_runner/web_frame_test_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 60386f99e61eabb3cd1fb311201b08858ff65222..4da42d73251f62257484d6aaf6ccb945adca25e1 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -212,6 +212,7 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void SetDomainRelaxationForbiddenForURLScheme(bool forbidden,
const std::string& scheme);
void SetDumpConsoleMessages(bool value);
+ void SetEffectiveConnectionType(const std::string& connection_type);
void SetMockSpellCheckerEnabled(bool enabled);
void SetImagesAllowed(bool allowed);
void SetIsolatedWorldContentSecurityPolicy(int world_id,
@@ -511,6 +512,8 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme)
.SetMethod("setDumpConsoleMessages",
&TestRunnerBindings::SetDumpConsoleMessages)
+ .SetMethod("setEffectiveConnectionType",
+ &TestRunnerBindings::SetEffectiveConnectionType)
.SetMethod("setMockSpellCheckerEnabled",
&TestRunnerBindings::SetMockSpellCheckerEnabled)
.SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented)
@@ -704,6 +707,29 @@ void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) {
runner_->SetDumpConsoleMessages(enabled);
}
+void TestRunnerBindings::SetEffectiveConnectionType(
+ const std::string& connection_type) {
+ blink::WebEffectiveConnectionType web_type =
+ blink::WebEffectiveConnectionType::TypeUnknown;
+ if (connection_type == "TypeUnknown")
+ web_type = blink::WebEffectiveConnectionType::TypeUnknown;
+ else if (connection_type == "TypeOffline")
+ web_type = blink::WebEffectiveConnectionType::TypeOffline;
+ else if (connection_type == "TypeSlow2G")
+ web_type = blink::WebEffectiveConnectionType::TypeSlow2G;
+ else if (connection_type == "Type2G")
+ web_type = blink::WebEffectiveConnectionType::Type2G;
+ else if (connection_type == "Type3G")
+ web_type = blink::WebEffectiveConnectionType::Type3G;
+ else if (connection_type == "Type4G")
+ web_type = blink::WebEffectiveConnectionType::Type4G;
+ else
+ NOTREACHED();
+
+ if (runner_)
+ runner_->SetEffectiveConnectionType(web_type);
+}
+
void TestRunnerBindings::SetMockSpellCheckerEnabled(bool enabled) {
if (runner_)
runner_->SetMockSpellCheckerEnabled(enabled);
@@ -1553,6 +1579,8 @@ TestRunner::TestRunner(TestInterfaces* interfaces)
chooser_count_(0),
previously_focused_view_(nullptr),
is_web_platform_tests_mode_(false),
+ effective_connection_type_(
+ blink::WebEffectiveConnectionType::TypeUnknown),
weak_factory_(this) {}
TestRunner::~TestRunner() {}
@@ -2564,6 +2592,11 @@ void TestRunner::SetDumpConsoleMessages(bool value) {
OnLayoutTestRuntimeFlagsChanged();
}
+void TestRunner::SetEffectiveConnectionType(
+ blink::WebEffectiveConnectionType connection_type) {
+ effective_connection_type_ = connection_type;
+}
+
void TestRunner::SetMockSpellCheckerEnabled(bool enabled) {
spellcheck_->SetEnabled(enabled);
}
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_frame_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698