Commit 89cebb0e authored by Jun Cai's avatar Jun Cai Committed by Commit Bot

Network Service: Use web::TestWebThreadBundle in the NetworkMetricsProviderTest

This is a follow-up CL from the comments at:
https://chromium-review.googlesource.com/c/chromium/src/+/1274585/11

This CL uses ifdef "using" decl to use web::TestWebThreadBundle on iOS as
the equivalent to content::TestBrowserThreadBundle.

Bug: 898307
Change-Id: I35620aade68dc2b6e9855be49afabd5fcd6dfd5d
Reviewed-on: https://chromium-review.googlesource.com/c/1313450Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Jun Cai <juncai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609382}
parent 079c13ca
......@@ -431,6 +431,10 @@ source_set("unit_tests") {
sources -= [ "child_call_stack_profile_collector_unittest.cc" ]
}
if (is_ios) {
deps += [ "//ios/web/public/test" ]
}
if (!is_ios) {
deps += [ "//content/test:test_support" ]
}
......
......@@ -5,6 +5,7 @@ include_rules = [
"+components/encrypted_messages",
"+components/variations",
"+content/public/test/test_browser_thread_bundle.h",
"+ios/web/public/test/test_web_thread_bundle.h",
"+net",
"+services/network/public/cpp",
"+services/network/test",
......
......@@ -22,9 +22,11 @@
#endif // OS_CHROMEOS
#if defined(OS_IOS)
#include "base/test/scoped_task_environment.h"
#include "ios/web/public/test/test_web_thread_bundle.h"
using TestThreadBundle = web::TestWebThreadBundle;
#else // !defined(OS_IOS)
#include "content/public/test/test_browser_thread_bundle.h"
using TestThreadBundle = content::TestBrowserThreadBundle;
#endif // defined(OS_IOS)
namespace metrics {
......@@ -33,14 +35,7 @@ class NetworkMetricsProviderTest : public testing::Test {
public:
protected:
NetworkMetricsProviderTest()
#if defined(OS_IOS)
: scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO)
#else // !defined(OS_IOS)
: test_browser_thread_bundle_(
content::TestBrowserThreadBundle::IO_MAINLOOP)
#endif // defined(OS_IOS)
{
: test_thread_bundle_(TestThreadBundle::IO_MAINLOOP) {
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Initialize();
chromeos::NetworkHandler::Initialize();
......@@ -48,11 +43,7 @@ class NetworkMetricsProviderTest : public testing::Test {
}
private:
#if defined(OS_IOS)
base::test::ScopedTaskEnvironment scoped_task_environment_;
#else // !defined(OS_IOS)
content::TestBrowserThreadBundle test_browser_thread_bundle_;
#endif // defined(OS_IOS)
TestThreadBundle test_thread_bundle_;
};
// Verifies that the effective connection type is correctly set.
......
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