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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 1976153002: Various NTPSnippetsService cleanups: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_service_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_service_unittest.cc b/components/ntp_snippets/ntp_snippets_service_unittest.cc
index dbaaed7c62e61ef409cb1adba9e8a3b3b67f7356..678fa81da66f669f74de533a464e8fffcd495adb 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -222,7 +222,10 @@ class NTPSnippetsServiceTest : public testing::Test {
switches::kDontRestrict);
}
- ~NTPSnippetsServiceTest() override {}
+ ~NTPSnippetsServiceTest() override {
+ if (service_)
+ service_->Shutdown();
+ }
void SetUp() override {
EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1);
@@ -230,6 +233,9 @@ class NTPSnippetsServiceTest : public testing::Test {
}
void CreateSnippetsService(bool enabled) {
+ if (service_)
+ service_->Shutdown();
+
scoped_refptr<base::SingleThreadTaskRunner> task_runner(
base::ThreadTaskRunnerHandle::Get());
scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
@@ -474,8 +480,7 @@ TEST_F(NTPSnippetsServiceTest, GetDiscarded) {
// For the test, we need the snippet to get discarded.
ASSERT_TRUE(service()->DiscardSnippet("http://localhost/foobar"));
- const NTPSnippetsService::NTPSnippetStorage& snippets =
- service()->discarded_snippets();
+ const NTPSnippet::PtrVector& snippets = service()->discarded_snippets();
EXPECT_EQ(1u, snippets.size());
for (auto& snippet : snippets) {
EXPECT_EQ("http://localhost/foobar", snippet->id());
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698