Index: ui/app_list/search/mixer_unittest.cc |
diff --git a/ui/app_list/search/mixer_unittest.cc b/ui/app_list/search/mixer_unittest.cc |
index 92e062983712b23ffdbbcc76d2ead44610320085..6e1809c370f8c810e126d854e9ba73cf62d49bd2 100644 |
--- a/ui/app_list/search/mixer_unittest.cc |
+++ b/ui/app_list/search/mixer_unittest.cc |
@@ -12,11 +12,9 @@ |
#include "base/macros.h" |
#include "base/memory/ptr_util.h" |
#include "base/memory/scoped_vector.h" |
-#include "base/metrics/field_trial.h" |
#include "base/strings/string16.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
-#include "base/test/mock_entropy_provider.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/app_list/app_list_model.h" |
#include "ui/app_list/search/history_types.h" |
@@ -28,7 +26,6 @@ namespace test { |
// Maximum number of results to show in each mixer group. |
const size_t kMaxAppsGroupResults = 4; |
-// Ignored unless AppListMixer field trial is "Blended". |
const size_t kMaxOmniboxResults = 4; |
const size_t kMaxWebstoreResults = 2; |
@@ -115,21 +112,13 @@ class TestSearchProvider : public SearchProvider { |
DISALLOW_COPY_AND_ASSIGN(TestSearchProvider); |
}; |
-// Test is parameterized with bool. True enables the "Blended" field trial. |
-class MixerTest : public testing::Test, |
- public testing::WithParamInterface<bool> { |
+class MixerTest : public testing::Test { |
public: |
- MixerTest() |
- : is_voice_query_(false), |
- field_trial_list_(new base::MockEntropyProvider()) {} |
+ MixerTest() : is_voice_query_(false) {} |
~MixerTest() override {} |
// testing::Test overrides: |
void SetUp() override { |
- // If the parameter is true, enable the field trial. |
- const char* field_trial_name = GetParam() ? "Blended" : "Control"; |
- base::FieldTrialList::CreateFieldTrial("AppListMixer", field_trial_name); |
- |
results_.reset(new AppListModel::SearchResults); |
providers_.push_back(new TestSearchProvider("app")); |
@@ -140,10 +129,9 @@ class MixerTest : public testing::Test, |
mixer_.reset(new Mixer(results_.get())); |
- size_t apps_group_id = mixer_->AddGroup(kMaxAppsGroupResults, 3.0, 1.0); |
- size_t omnibox_group_id = |
- mixer_->AddOmniboxGroup(kMaxOmniboxResults, 2.0, 1.0); |
- size_t webstore_group_id = mixer_->AddGroup(kMaxWebstoreResults, 1.0, 0.5); |
+ size_t apps_group_id = mixer_->AddGroup(kMaxAppsGroupResults, 1.0); |
+ size_t omnibox_group_id = mixer_->AddGroup(kMaxOmniboxResults, 1.0); |
+ size_t webstore_group_id = mixer_->AddGroup(kMaxWebstoreResults, 0.5); |
mixer_->AddProviderToGroup(apps_group_id, providers_[0]); |
mixer_->AddProviderToGroup(omnibox_group_id, providers_[1]); |
@@ -196,57 +184,48 @@ class MixerTest : public testing::Test, |
ScopedVector<TestSearchProvider> providers_; |
- base::FieldTrialList field_trial_list_; |
- |
DISALLOW_COPY_AND_ASSIGN(MixerTest); |
}; |
-TEST_P(MixerTest, Basic) { |
- // Note: Some cases in |expected_blended| have vastly more results than |
- // others, due to the "at least 6" mechanism. If it gets at least 6 results |
- // from all providers, it stops at 6. If not, it fetches potentially many more |
- // results from all providers. Not ideal, but currently by design. |
+TEST_F(MixerTest, Basic) { |
+ // Note: Some cases in |expected| have vastly more results than others, due to |
+ // the "at least 6" mechanism. If it gets at least 6 results from all |
+ // providers, it stops at 6. If not, it fetches potentially many more results |
+ // from all providers. Not ideal, but currently by design. |
struct TestCase { |
const size_t app_results; |
const size_t omnibox_results; |
const size_t webstore_results; |
- const char* expected_default; // Expected results with trial off. |
- const char* expected_blended; // Expected results with trial on. |
+ const char* expected; |
} kTestCases[] = { |
- {0, 0, 0, "", ""}, |
- {10, 0, 0, "app0,app1,app2,app3", |
- "app0,app1,app2,app3,app4,app5,app6,app7,app8,app9"}, |
- {0, 0, 10, "webstore0,webstore1", |
+ {0, 0, 0, ""}, |
+ {10, 0, 0, "app0,app1,app2,app3,app4,app5,app6,app7,app8,app9"}, |
+ {0, 0, 10, |
"webstore0,webstore1,webstore2,webstore3,webstore4,webstore5,webstore6," |
"webstore7,webstore8,webstore9"}, |
- {4, 6, 0, "app0,app1,app2,app3,omnibox0,omnibox1", |
- "app0,omnibox0,app1,omnibox1,app2,omnibox2,app3,omnibox3"}, |
- {4, 6, 2, "app0,app1,app2,app3,omnibox0,webstore0", |
+ {4, 6, 0, "app0,omnibox0,app1,omnibox1,app2,omnibox2,app3,omnibox3"}, |
+ {4, 6, 2, |
"app0,omnibox0,app1,omnibox1,app2,omnibox2,app3,omnibox3,webstore0," |
"webstore1"}, |
- {10, 10, 10, "app0,app1,app2,app3,omnibox0,webstore0", |
+ {10, 10, 10, |
"app0,omnibox0,app1,omnibox1,app2,omnibox2,app3,omnibox3,webstore0," |
"webstore1"}, |
- {0, 10, 0, "omnibox0,omnibox1,omnibox2,omnibox3,omnibox4,omnibox5", |
+ {0, 10, 0, |
"omnibox0,omnibox1,omnibox2,omnibox3,omnibox4,omnibox5,omnibox6," |
"omnibox7,omnibox8,omnibox9"}, |
- {0, 10, 1, "omnibox0,omnibox1,omnibox2,omnibox3,omnibox4,webstore0", |
+ {0, 10, 1, |
"omnibox0,omnibox1,omnibox2,omnibox3,webstore0,omnibox4,omnibox5," |
"omnibox6,omnibox7,omnibox8,omnibox9"}, |
- {0, 10, 2, "omnibox0,omnibox1,omnibox2,omnibox3,webstore0,webstore1", |
- "omnibox0,omnibox1,omnibox2,omnibox3,webstore0,webstore1"}, |
- {1, 10, 0, "app0,omnibox0,omnibox1,omnibox2,omnibox3,omnibox4", |
+ {0, 10, 2, "omnibox0,omnibox1,omnibox2,omnibox3,webstore0,webstore1"}, |
+ {1, 10, 0, |
"app0,omnibox0,omnibox1,omnibox2,omnibox3,omnibox4,omnibox5,omnibox6," |
"omnibox7,omnibox8,omnibox9"}, |
- {2, 10, 0, "app0,app1,omnibox0,omnibox1,omnibox2,omnibox3", |
- "app0,omnibox0,app1,omnibox1,omnibox2,omnibox3"}, |
- {2, 10, 1, "app0,app1,omnibox0,omnibox1,omnibox2,webstore0", |
- "app0,omnibox0,app1,omnibox1,omnibox2,omnibox3,webstore0"}, |
- {2, 10, 2, "app0,app1,omnibox0,omnibox1,webstore0,webstore1", |
+ {2, 10, 0, "app0,omnibox0,app1,omnibox1,omnibox2,omnibox3"}, |
+ {2, 10, 1, "app0,omnibox0,app1,omnibox1,omnibox2,omnibox3,webstore0"}, |
+ {2, 10, 2, |
"app0,omnibox0,app1,omnibox1,omnibox2,omnibox3,webstore0,webstore1"}, |
- {2, 0, 2, "app0,app1,webstore0,webstore1", |
- "app0,app1,webstore0,webstore1"}, |
- {0, 0, 0, "", ""}, |
+ {2, 0, 2, "app0,app1,webstore0,webstore1"}, |
+ {0, 0, 0, ""}, |
}; |
for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
@@ -255,13 +234,11 @@ TEST_P(MixerTest, Basic) { |
webstore_provider()->set_count(kTestCases[i].webstore_results); |
RunQuery(); |
- const char* expected = GetParam() ? kTestCases[i].expected_blended |
- : kTestCases[i].expected_default; |
- EXPECT_EQ(expected, GetResults()) << "Case " << i; |
+ EXPECT_EQ(kTestCases[i].expected, GetResults()) << "Case " << i; |
} |
} |
-TEST_P(MixerTest, RemoveDuplicates) { |
+TEST_F(MixerTest, RemoveDuplicates) { |
const std::string dup = "dup"; |
// This gives "dup0,dup1,dup2". |
@@ -283,7 +260,7 @@ TEST_P(MixerTest, RemoveDuplicates) { |
} |
// Tests that "known results" have priority over others. |
-TEST_P(MixerTest, KnownResultsPriority) { |
+TEST_F(MixerTest, KnownResultsPriority) { |
// This gives omnibox 0 -- 5. |
omnibox_provider()->set_count(6); |
@@ -302,7 +279,7 @@ TEST_P(MixerTest, KnownResultsPriority) { |
} |
// Tests that "known results" are not considered for recommendation results. |
-TEST_P(MixerTest, KnownResultsIgnoredForRecommendations) { |
+TEST_F(MixerTest, KnownResultsIgnoredForRecommendations) { |
// This gives omnibox 0 -- 5. |
omnibox_provider()->set_count(6); |
omnibox_provider()->set_display_type(SearchResult::DISPLAY_RECOMMENDATION); |
@@ -320,7 +297,7 @@ TEST_P(MixerTest, KnownResultsIgnoredForRecommendations) { |
GetResults()); |
} |
-TEST_P(MixerTest, VoiceQuery) { |
+TEST_F(MixerTest, VoiceQuery) { |
omnibox_provider()->set_count(3); |
RunQuery(); |
EXPECT_EQ("omnibox0,omnibox1,omnibox2", GetResults()); |
@@ -342,7 +319,7 @@ TEST_P(MixerTest, VoiceQuery) { |
EXPECT_EQ("omnibox1,omnibox2,omnibox0", GetResults()); |
} |
-TEST_P(MixerTest, Publish) { |
+TEST_F(MixerTest, Publish) { |
std::unique_ptr<SearchResult> result1(new TestSearchResult("app1", 0)); |
std::unique_ptr<SearchResult> result2(new TestSearchResult("app2", 0)); |
std::unique_ptr<SearchResult> result3(new TestSearchResult("app3", 0)); |
@@ -430,7 +407,5 @@ TEST_P(MixerTest, Publish) { |
TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); |
} |
-INSTANTIATE_TEST_CASE_P(MixerTestInstance, MixerTest, testing::Bool()); |
- |
} // namespace test |
} // namespace app_list |