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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 2357163004: [NTP Snippets] Remove scheduled re-scheduling (Closed)
Patch Set: super-nit, rebase Created 4 years, 3 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 a2e4abccee49cf86e622da52ddb13f1623485612..42721eebf41e2db4b10b77934123f0636902d31c 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -260,10 +260,9 @@ class FailingFakeURLFetcherFactory : public net::URLFetcherFactory {
class MockScheduler : public NTPSnippetsScheduler {
public:
- MOCK_METHOD3(Schedule,
+ MOCK_METHOD2(Schedule,
bool(base::TimeDelta period_wifi,
- base::TimeDelta period_fallback,
- base::Time reschedule_time));
+ base::TimeDelta period_fallback));
MOCK_METHOD0(Unschedule, bool());
};
@@ -482,7 +481,7 @@ TEST_F(NTPSnippetsServiceTest, ScheduleOnStart) {
// We should get two |Schedule| calls: The first when initialization
// completes, the second one after the automatic (since the service doesn't
// have any data yet) fetch finishes.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
auto service = MakeSnippetsService();
// When we have no snippets are all, loading the service initiates a fetch.
@@ -494,12 +493,12 @@ TEST_F(NTPSnippetsServiceTest, RescheduleAfterSuccessfulFetch) {
// We should get two |Schedule| calls: The first when initialization
// completes, the second one after the automatic (since the service doesn't
// have any data yet) fetch finishes.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
auto service = MakeSnippetsService();
base::RunLoop().RunUntilIdle();
// A successful fetch should trigger another |Schedule|.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _));
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _));
LoadFromJSONString(service.get(), GetTestJson({GetSnippet()}));
}
@@ -507,12 +506,12 @@ TEST_F(NTPSnippetsServiceTest, DontRescheduleAfterFailedFetch) {
// We should get two |Schedule| calls: The first when initialization
// completes, the second one after the automatic (since the service doesn't
// have any data yet) fetch finishes.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
auto service = MakeSnippetsService();
base::RunLoop().RunUntilIdle();
// A failed fetch should NOT trigger another |Schedule|.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(0);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(0);
LoadFromJSONString(service.get(), GetTestJson({GetInvalidSnippet()}));
}
@@ -520,7 +519,7 @@ TEST_F(NTPSnippetsServiceTest, DontRescheduleBeforeInit) {
// We should get two |Schedule| calls: The first when initialization
// completes, the second one after the automatic (since the service doesn't
// have any data yet) fetch finishes.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
// The |RescheduleFetching| call shouldn't do anything (in particular not
// result in an |Unschedule|), since the service isn't initialized yet.
EXPECT_CALL(mock_scheduler(), Unschedule()).Times(0);
@@ -529,7 +528,7 @@ TEST_F(NTPSnippetsServiceTest, DontRescheduleBeforeInit) {
WaitForSnippetsServiceInitialization();
// Now that initialization has finished, |RescheduleFetching| should work.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _));
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _));
service->RescheduleFetching();
}
@@ -537,11 +536,11 @@ TEST_F(NTPSnippetsServiceTest, RescheduleOnStateChange) {
{
InSequence s;
// Initial startup.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
// Service gets disabled.
EXPECT_CALL(mock_scheduler(), Unschedule());
// Service gets enabled again.
- EXPECT_CALL(mock_scheduler(), Schedule(_, _, _)).Times(2);
+ EXPECT_CALL(mock_scheduler(), Schedule(_, _)).Times(2);
}
auto service = MakeSnippetsService();
ASSERT_TRUE(service->ready());
« 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