Commit 297c4e75 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

[scheduling] Use ScopedTaskEnvironment instead of MessageLoop in ntp_snippets

MessageLoop will go away, eventually.

BUG=891670

Change-Id: I443fe09079186ef8a2e2680efd6346b5f509b61c
Reviewed-on: https://chromium-review.googlesource.com/c/1352780Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#615986}
parent 2e5e1813
...@@ -95,7 +95,7 @@ BreakingNewsGCMAppHandler::BreakingNewsGCMAppHandler( ...@@ -95,7 +95,7 @@ BreakingNewsGCMAppHandler::BreakingNewsGCMAppHandler(
PrefService* pref_service, PrefService* pref_service,
std::unique_ptr<SubscriptionManager> subscription_manager, std::unique_ptr<SubscriptionManager> subscription_manager,
const ParseJSONCallback& parse_json_callback, const ParseJSONCallback& parse_json_callback,
base::Clock* clock, const base::Clock* clock,
std::unique_ptr<base::OneShotTimer> token_validation_timer, std::unique_ptr<base::OneShotTimer> token_validation_timer,
std::unique_ptr<base::OneShotTimer> forced_subscription_timer) std::unique_ptr<base::OneShotTimer> forced_subscription_timer)
: gcm_driver_(gcm_driver), : gcm_driver_(gcm_driver),
......
...@@ -53,7 +53,7 @@ class BreakingNewsGCMAppHandler : public BreakingNewsListener, ...@@ -53,7 +53,7 @@ class BreakingNewsGCMAppHandler : public BreakingNewsListener,
PrefService* pref_service_, PrefService* pref_service_,
std::unique_ptr<SubscriptionManager> subscription_manager, std::unique_ptr<SubscriptionManager> subscription_manager,
const ParseJSONCallback& parse_json_callback, const ParseJSONCallback& parse_json_callback,
base::Clock* clock, const base::Clock* clock,
std::unique_ptr<base::OneShotTimer> token_validation_timer, std::unique_ptr<base::OneShotTimer> token_validation_timer,
std::unique_ptr<base::OneShotTimer> forced_subscription_timer); std::unique_ptr<base::OneShotTimer> forced_subscription_timer);
...@@ -128,7 +128,7 @@ class BreakingNewsGCMAppHandler : public BreakingNewsListener, ...@@ -128,7 +128,7 @@ class BreakingNewsGCMAppHandler : public BreakingNewsListener,
PrefService* const pref_service_; PrefService* const pref_service_;
const std::unique_ptr<SubscriptionManager> subscription_manager_; const std::unique_ptr<SubscriptionManager> subscription_manager_;
const ParseJSONCallback parse_json_callback_; const ParseJSONCallback parse_json_callback_;
base::Clock* clock_; const base::Clock* clock_;
// Called every time a push-by-value message is received to notify the // Called every time a push-by-value message is received to notify the
// observer. // observer.
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#include "components/ntp_snippets/breaking_news/subscription_json_request.h" #include "components/ntp_snippets/breaking_news/subscription_json_request.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/message_loop/message_loop.h" #include "base/run_loop.h"
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "base/test/gtest_util.h" #include "base/test/gtest_util.h"
#include "base/test/mock_callback.h" #include "base/test/mock_callback.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h" #include "base/values.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
...@@ -79,7 +80,7 @@ class SubscriptionJsonRequestTest : public testing::Test { ...@@ -79,7 +80,7 @@ class SubscriptionJsonRequestTest : public testing::Test {
} }
private: private:
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
#include "components/ntp_snippets/breaking_news/subscription_manager_impl.h" #include "components/ntp_snippets/breaking_news/subscription_manager_impl.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop/message_loop.h" #include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_task_environment.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/ntp_snippets/pref_names.h" #include "components/ntp_snippets/pref_names.h"
#include "components/ntp_snippets/remote/test_utils.h" #include "components/ntp_snippets/remote/test_utils.h"
...@@ -122,7 +123,7 @@ class SubscriptionManagerImplTest : public testing::Test { ...@@ -122,7 +123,7 @@ class SubscriptionManagerImplTest : public testing::Test {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
test::RemoteSuggestionsTestUtils utils_; test::RemoteSuggestionsTestUtils utils_;
identity::IdentityTestEnvironment identity_test_env_; identity::IdentityTestEnvironment identity_test_env_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/mock_callback.h" #include "base/test/mock_callback.h"
#include "base/test/scoped_task_environment.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "components/ntp_snippets/category_info.h" #include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/category_rankers/constant_category_ranker.h" #include "components/ntp_snippets/category_rankers/constant_category_ranker.h"
...@@ -291,8 +291,7 @@ TEST_F(ContentSuggestionsServiceTest, ShouldRedirectFetchSuggestionImage) { ...@@ -291,8 +291,7 @@ TEST_F(ContentSuggestionsServiceTest, ShouldRedirectFetchSuggestionImage) {
TEST_F(ContentSuggestionsServiceTest, TEST_F(ContentSuggestionsServiceTest,
ShouldCallbackEmptyImageForUnavailableProvider) { ShouldCallbackEmptyImageForUnavailableProvider) {
// Setup the current thread's MessageLoop. base::test::ScopedTaskEnvironment scoped_task_environment;
base::MessageLoop message_loop;
base::RunLoop run_loop; base::RunLoop run_loop;
// Assuming there will never be a category with the id below. // Assuming there will never be a category with the id below.
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/mock_callback.h" #include "base/test/mock_callback.h"
#include "base/test/scoped_task_environment.h"
#include "components/image_fetcher/core/image_fetcher_impl.h" #include "components/image_fetcher/core/image_fetcher_impl.h"
#include "components/ntp_snippets/category_info.h" #include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/content_suggestion.h" #include "components/ntp_snippets/content_suggestion.h"
...@@ -126,7 +126,7 @@ class ContextualContentSuggestionsServiceTest : public testing::Test { ...@@ -126,7 +126,7 @@ class ContextualContentSuggestionsServiceTest : public testing::Test {
private: private:
FakeContextualSuggestionsFetcher* fetcher_; FakeContextualSuggestionsFetcher* fetcher_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
TestingPrefServiceSimple pref_service_; TestingPrefServiceSimple pref_service_;
std::unique_ptr<ContextualContentSuggestionsService> source_; std::unique_ptr<ContextualContentSuggestionsService> source_;
......
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