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

Unified Diff: components/test_runner/test_runner.cc

Issue 2022783002: Skeleton of the Safe Browsing Subresource Filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement RenderFrameObserver::OnDestruct introduced by rebase. Created 4 years, 6 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/test_runner.gyp » ('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 1ac13097a7a84bfb8f17684a8730c9580ccdcf0f..0639f8d67adfb83940a2afb48dcc9c848a029412 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -20,6 +20,7 @@
#include "components/test_runner/mock_content_settings_client.h"
#include "components/test_runner/mock_credential_manager_client.h"
#include "components/test_runner/mock_screen_orientation_client.h"
+#include "components/test_runner/mock_web_document_subresource_filter.h"
#include "components/test_runner/mock_web_speech_recognizer.h"
#include "components/test_runner/mock_web_user_media_client.h"
#include "components/test_runner/pixel_dump.h"
@@ -209,6 +210,8 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void SetCustomPolicyDelegate(gin::Arguments* args);
void SetCustomTextOutput(const std::string& output);
void SetDatabaseQuota(int quota);
+ void SetDisallowedSubresourcePathSuffixes(
+ const std::vector<std::string>& suffixes);
void SetDomainRelaxationForbiddenForURLScheme(bool forbidden,
const std::string& scheme);
void SetDumpConsoleMessages(bool value);
@@ -363,6 +366,8 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::DisableAutoResizeMode)
.SetMethod("disableMockScreenOrientation",
&TestRunnerBindings::DisableMockScreenOrientation)
+ .SetMethod("setDisallowedSubresourcePathSuffixes",
+ &TestRunnerBindings::SetDisallowedSubresourcePathSuffixes)
.SetMethod("dispatchBeforeInstallPromptEvent",
&TestRunnerBindings::DispatchBeforeInstallPromptEvent)
.SetMethod("dumpAsMarkup", &TestRunnerBindings::DumpAsMarkup)
@@ -470,8 +475,7 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::ResetTestHelperControllers)
.SetMethod("resolveBeforeInstallPromptPromise",
&TestRunnerBindings::ResolveBeforeInstallPromptPromise)
- .SetMethod("runIdleTasks",
- &TestRunnerBindings::RunIdleTasks)
+ .SetMethod("runIdleTasks", &TestRunnerBindings::RunIdleTasks)
.SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup)
// The Bluetooth functions are specified at
@@ -485,8 +489,7 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::SetAllowFileAccessFromFileURLs)
.SetMethod("setAllowRunningOfInsecureContent",
&TestRunnerBindings::SetAllowRunningOfInsecureContent)
- .SetMethod("setAutoplayAllowed",
- &TestRunnerBindings::SetAutoplayAllowed)
+ .SetMethod("setAutoplayAllowed", &TestRunnerBindings::SetAutoplayAllowed)
.SetMethod("setAllowUniversalAccessFromFileURLs",
&TestRunnerBindings::SetAllowUniversalAccessFromFileURLs)
.SetMethod("setAlwaysAcceptCookies",
@@ -937,6 +940,12 @@ void TestRunnerBindings::DisableMockScreenOrientation() {
runner_->DisableMockScreenOrientation();
}
+void TestRunnerBindings::SetDisallowedSubresourcePathSuffixes(
+ const std::vector<std::string>& suffixes) {
+ if (runner_)
+ runner_->SetDisallowedSubresourcePathSuffixes(suffixes);
+}
+
void TestRunnerBindings::DidAcquirePointerLock() {
if (view_runner_)
view_runner_->DidAcquirePointerLock();
@@ -2487,6 +2496,13 @@ void TestRunner::DumpPermissionClientCallbacks() {
OnLayoutTestRuntimeFlagsChanged();
}
+void TestRunner::SetDisallowedSubresourcePathSuffixes(
+ const std::vector<std::string>& suffixes) {
+ DCHECK(main_view_);
+ main_view_->mainFrame()->dataSource()->setSubresourceFilter(
+ new MockWebDocumentSubresourceFilter(suffixes));
+}
+
void TestRunner::DumpWindowStatusChanges() {
layout_test_runtime_flags_.set_dump_window_status_changes(true);
OnLayoutTestRuntimeFlagsChanged();
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/test_runner.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698