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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 2244793002: Remove deleted offline page suggestions from opened NTPs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Michael's and Marc's comments Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/ntp_snippets/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 class MockProviderObserver : public ContentSuggestionsProvider::Observer { 229 class MockProviderObserver : public ContentSuggestionsProvider::Observer {
230 public: 230 public:
231 void OnNewSuggestions(ContentSuggestionsProvider* provider, 231 void OnNewSuggestions(ContentSuggestionsProvider* provider,
232 Category category, 232 Category category,
233 std::vector<ContentSuggestion> suggestions) override {} 233 std::vector<ContentSuggestion> suggestions) override {}
234 MOCK_METHOD3(OnCategoryStatusChanged, 234 MOCK_METHOD3(OnCategoryStatusChanged,
235 void(ContentSuggestionsProvider* provider, 235 void(ContentSuggestionsProvider* provider,
236 Category category, 236 Category category,
237 CategoryStatus new_status)); 237 CategoryStatus new_status));
238 MOCK_METHOD3(OnSuggestionInvalidated,
239 void(ContentSuggestionsProvider* provider,
240 Category category,
241 const std::string& suggestion_id));
238 }; 242 };
239 243
240 class WaitForDBLoad { 244 class WaitForDBLoad {
241 public: 245 public:
242 WaitForDBLoad(MockProviderObserver* observer, NTPSnippetsService* service) 246 WaitForDBLoad(MockProviderObserver* observer, NTPSnippetsService* service)
243 : observer_(observer) { 247 : observer_(observer) {
244 EXPECT_CALL(*observer_, OnCategoryStatusChanged(_, _, _)) 248 EXPECT_CALL(*observer_, OnCategoryStatusChanged(_, _, _))
245 .WillOnce(Invoke(this, &WaitForDBLoad::OnCategoryStatusChanged)); 249 .WillOnce(Invoke(this, &WaitForDBLoad::OnCategoryStatusChanged));
246 if (!service->ready()) 250 if (!service->ready())
247 run_loop_.Run(); 251 run_loop_.Run();
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); 884 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1);
881 service()->OnDisabledReasonChanged(DisabledReason::NONE); 885 service()->OnDisabledReasonChanged(DisabledReason::NONE);
882 EXPECT_CALL(observer(), 886 EXPECT_CALL(observer(),
883 OnCategoryStatusChanged(_, _, CategoryStatus::AVAILABLE)); 887 OnCategoryStatusChanged(_, _, CategoryStatus::AVAILABLE));
884 base::RunLoop().RunUntilIdle(); 888 base::RunLoop().RunUntilIdle();
885 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_); 889 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_);
886 EXPECT_FALSE(service()->GetSnippetsForTesting().empty()); 890 EXPECT_FALSE(service()->GetSnippetsForTesting().empty());
887 } 891 }
888 892
889 } // namespace ntp_snippets 893 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698