Commit ba0d17f7 authored by Charles Harrison's avatar Charles Harrison Committed by Commit Bot

[subresource_filter] Fake being after startup in browser tests

This should speed up the wall time of these browser tests significantly
h/t to jkarlin for discovering this issue.

Bug: 819721
Change-Id: I5368234cd3ea729eb262af22233df496e1368c4b
Reviewed-on: https://chromium-review.googlesource.com/953803Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541882}
parent b30851c6
......@@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_database_helper.h"
#include "chrome/browser/subresource_filter/subresource_filter_profile_context.h"
#include "chrome/browser/subresource_filter/subresource_filter_profile_context_factory.h"
......@@ -25,6 +26,7 @@
#include "components/safe_browsing/db/v4_protocol_manager_util.h"
#include "components/safe_browsing/db/v4_test_util.h"
#include "components/safe_browsing/features.h"
#include "components/subresource_filter/content/browser/content_ruleset_service.h"
#include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
......@@ -58,6 +60,13 @@ void SubresourceFilterBrowserTest::TearDown() {
}
void SubresourceFilterBrowserTest::SetUpOnMainThread() {
// Note: even after startup, tasks posted to be run after startup are
// artificially delayed up to 10s. To avoid that delay in tests, just fake
// being after startup internally so there is no delay when writing and
// publishing rulesets.
g_browser_process->subresource_filter_ruleset_service()
->SetIsAfterStartupForTesting();
base::FilePath test_data_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir));
embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
......
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