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

Unified Diff: components/suggestions/suggestions_service_impl.h

Issue 2869013004: Test SuggestionsServiceImpl without friending anything (Closed)
Patch Set: Rebase (to HEAD) Created 3 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
Index: components/suggestions/suggestions_service_impl.h
diff --git a/components/suggestions/suggestions_service_impl.h b/components/suggestions/suggestions_service_impl.h
index 7bd2959d65b3a3d315adc732a59b799f8d543d56..f01cb85474510f81a06c35e231bbd6337c55305f 100644
--- a/components/suggestions/suggestions_service_impl.h
+++ b/components/suggestions/suggestions_service_impl.h
@@ -78,6 +78,16 @@ class SuggestionsServiceImpl : public SuggestionsService,
bool UndoBlacklistURL(const GURL& url) override;
void ClearBlacklist() override;
+ base::TimeDelta blacklist_delay_for_testing() const {
Marc Treib 2017/05/10 09:53:44 Out of curiosity: Do you feel that "for_testing" m
fhorschig 2017/05/10 11:54:44 In this case, I am (obviously) absolutely for for_
+ return scheduling_delay_;
+ }
+ void set_blacklist_delay_for_testing(base::TimeDelta delay) {
+ scheduling_delay_ = delay;
+ }
+ bool has_pending_request_for_testing() const {
+ return !!pending_request_.get();
+ }
+
// Determines which URL a blacklist request was for, irrespective of the
// request's status. Returns false if |request| is not a blacklist request.
static bool GetBlacklistedUrl(const net::URLFetcher& request, GURL* url);
@@ -86,35 +96,6 @@ class SuggestionsServiceImpl : public SuggestionsService,
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
private:
- friend class SuggestionsServiceTest;
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, FetchSuggestionsData);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, IgnoresNoopSyncChange);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- IgnoresUninterestingSyncChange);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, DoesNotFetchOnStartup);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- FetchSuggestionsDataSyncNotInitializedEnabled);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- FetchSuggestionsDataSyncDisabled);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- FetchSuggestionsDataNoAccessToken);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- IssueRequestIfNoneOngoingError);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- IssueRequestIfNoneOngoingResponseNotOK);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, BlacklistURL);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, BlacklistURLRequestFails);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, ClearBlacklist);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, UndoBlacklistURL);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- UndoBlacklistURLFailsIfNotInBlacklist);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- UndoBlacklistURLFailsIfAlreadyCandidate);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest,
- GetBlacklistedUrlBlacklistRequest);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, UpdateBlacklistDelay);
- FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, CheckDefaultTimeStamps);
-
// Establishes the different sync states that matter to SuggestionsService.
enum SyncState {
// State: Sync service is not initialized, yet not disabled. History sync
@@ -200,10 +181,6 @@ class SuggestionsServiceImpl : public SuggestionsService,
// Adds extra data to suggestions profile.
void PopulateExtraData(SuggestionsProfile* suggestions);
- // Test seams.
- base::TimeDelta blacklist_delay() const { return scheduling_delay_; }
- void set_blacklist_delay(base::TimeDelta delay) { scheduling_delay_ = delay; }
-
base::ThreadChecker thread_checker_;
SigninManagerBase* signin_manager_;

Powered by Google App Engine
This is Rietveld 408576698