Commit b582063f authored by Min Qin's avatar Min Qin Committed by Commit Bot

Avoid setting NetworkChangeNotifierFactory multiple times for AwBrowserContextTest

Setup() is called on each test and it will set the global
NetworkChangeNotifierFactory multiple times, causing a CHECK
failure in NetworkChangeNotifier::SetFactory().

This CL fixes the issue by not setting the factory if it is
already set.

BUG=1023050

Change-Id: I61e2ca89e0c2409bdd8f8725c2e96bf706618da8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909810Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714606}
parent 2f3baa76
......@@ -17,6 +17,12 @@ namespace android_webview {
class AwBrowserContextTest : public testing::Test {
protected:
// Runs before the first test
static void SetUpTestSuite() {
net::NetworkChangeNotifier::SetFactory(
new AwNetworkChangeNotifierFactory());
}
void SetUp() override {
mojo::core::Init();
test_content_client_initializer_ =
......@@ -25,8 +31,6 @@ class AwBrowserContextTest : public testing::Test {
AwFeatureListCreator* aw_feature_list_creator = new AwFeatureListCreator();
aw_feature_list_creator->CreateLocalState();
browser_process_ = new AwBrowserProcess(aw_feature_list_creator);
net::NetworkChangeNotifier::SetFactory(
new AwNetworkChangeNotifierFactory());
}
void TearDown() override {
......
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