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

Unified Diff: components/suggestions/suggestions_service_impl_unittest.cc

Issue 2872573002: Use |min| param to query a variable number of suggestions (Closed)
Patch Set: Use format strings to concat parameters 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_unittest.cc
diff --git a/components/suggestions/suggestions_service_impl_unittest.cc b/components/suggestions/suggestions_service_impl_unittest.cc
index ef75e2e29faa22390c8be68c67e60be99ae75da0..150a962294814783e48c6b9b53d1177b3d917947 100644
--- a/components/suggestions/suggestions_service_impl_unittest.cc
+++ b/components/suggestions/suggestions_service_impl_unittest.cc
@@ -14,11 +14,13 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
+#include "base/test/scoped_feature_list.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
#include "components/signin/core/browser/fake_signin_manager.h"
#include "components/signin/core/browser/test_signin_client.h"
#include "components/suggestions/blacklist_store.h"
+#include "components/suggestions/features.h"
#include "components/suggestions/image_manager.h"
#include "components/suggestions/proto/suggestions.pb.h"
#include "components/suggestions/suggestions_store.h"
@@ -26,6 +28,7 @@
#include "components/sync/driver/sync_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "net/base/escape.h"
+#include "net/base/url_util.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -330,6 +333,15 @@ TEST_F(SuggestionsServiceTest, IgnoresUninterestingSyncChange) {
EXPECT_EQ(0, suggestions_data_callback_count_);
}
+TEST_F(SuggestionsServiceTest, BuildUrlWithMinEqualsZeroParamForFewFeature) {
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitAndEnableFeature(kUseSuggestionsEvenIfFewFeature);
+ std::string min_suggestions;
+ EXPECT_TRUE(net::GetValueForKeyInQuery(
+ SuggestionsServiceImpl::BuildSuggestionsURL(), "min", &min_suggestions));
+ EXPECT_EQ(min_suggestions, "0");
+}
+
TEST_F(SuggestionsServiceTest, FetchSuggestionsDataSyncNotInitializedEnabled) {
EXPECT_CALL(mock_sync_service_, IsSyncActive()).WillRepeatedly(Return(false));
suggestions_service_->OnStateChanged(&mock_sync_service_);

Powered by Google App Engine
This is Rietveld 408576698