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

Unified Diff: chrome/browser/rlz/rlz_unittest.cc

Issue 220193005: Add RLZ Access points for the app launcher. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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: chrome/browser/rlz/rlz_unittest.cc
diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc
index f78a1d9416f7c7081c250d281c5f371e060db239..1b83d957b4b5953792e24dd463d45268fc978d9d 100644
--- a/chrome/browser/rlz/rlz_unittest.cc
+++ b/chrome/browser/rlz/rlz_unittest.cc
@@ -37,8 +37,10 @@ namespace {
// Dummy RLZ string for the access points.
const char kOmniboxRlzString[] = "test_omnibox";
const char kHomepageRlzString[] = "test_homepage";
+const char kApplistRlzString[] = "test_applist";
const char kNewOmniboxRlzString[] = "new_omnibox";
const char kNewHomepageRlzString[] = "new_homepage";
+const char kNewApplistRlzString[] = "new_applist";
// Some helper macros to test it a string contains/does not contain a substring.
@@ -145,6 +147,8 @@ class TestRLZTracker : public RLZTracker {
kNewOmniboxRlzString);
rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE,
kNewHomepageRlzString);
+ rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST,
+ kNewApplistRlzString);
return true;
}
@@ -306,6 +310,10 @@ const char kOmniboxFirstSearch[] = "C1F";
const char kHomepageInstall[] = "C2I";
const char kHomepageSetToGoogle[] = "C2S";
const char kHomepageFirstSeach[] = "C2F";
+
+const char kApplistInstall[] = "C7I";
+const char kApplistSetToGoogle[] = "C7S";
+const char kApplistFirstSearch[] = "C7F";
#elif defined(OS_MACOSX)
const char kOmniboxInstall[] = "C5I";
const char kOmniboxSetToGoogle[] = "C5S";
@@ -314,6 +322,10 @@ const char kOmniboxFirstSearch[] = "C5F";
const char kHomepageInstall[] = "C6I";
const char kHomepageSetToGoogle[] = "C6S";
const char kHomepageFirstSeach[] = "C6F";
+
+const char kApplistInstall[] = "C8I";
+const char kApplistSetToGoogle[] = "C8S";
+const char kApplistFirstSearch[] = "C8F";
#elif defined(OS_CHROMEOS)
const char kOmniboxInstall[] = "CAI";
const char kOmniboxSetToGoogle[] = "CAS";
@@ -322,6 +334,10 @@ const char kOmniboxFirstSearch[] = "CAF";
const char kHomepageInstall[] = "CBI";
const char kHomepageSetToGoogle[] = "CBS";
const char kHomepageFirstSeach[] = "CBF";
+
+const char kApplistInstall[] = "CCI";
+const char kApplistSetToGoogle[] = "CCS";
+const char kApplistFirstSearch[] = "CCF";
#endif
Roger Tawa OOO till Jul 10th 2014/04/01 14:20:18 I think we need tests specific to iOS. This is im
Sam McNally 2014/04/02 01:27:28 Changed to use #ifdefs for iOS instead.
const base::TimeDelta kDelay = base::TimeDelta::FromMilliseconds(20);
@@ -346,6 +362,11 @@ TEST_F(RlzLibTest, QuickStopAfterStart) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, false);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(false);
}
@@ -363,6 +384,11 @@ TEST_F(RlzLibTest, DelayedInitOnly) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, true);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -380,6 +406,11 @@ TEST_F(RlzLibTest, DelayedInitOnlyGoogleAsStartup) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -397,6 +428,11 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRunNoRlzStrings) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, true);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -414,6 +450,11 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRunNoRlzStringsGoogleAsStartup) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -422,6 +463,7 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRun) {
// performed a successful ping to the RLZ server.
rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString);
rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, kHomepageRlzString);
+ rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST, kApplistRlzString);
TestRLZTracker::InitRlzDelayed(false, false, kDelay, true, true, true);
InvokeDelayedInit();
@@ -436,6 +478,11 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRun) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -453,6 +500,11 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoGoogleDefaultSearchOrHomepageOrStartup) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -470,6 +522,11 @@ TEST_F(RlzLibTest, OmniboxUsageOnly) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, false);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(false);
}
@@ -487,6 +544,11 @@ TEST_F(RlzLibTest, HomepageUsageOnly) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, false);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(false);
}
@@ -506,6 +568,11 @@ TEST_F(RlzLibTest, UsageBeforeDelayedInit) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, true);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -525,6 +592,11 @@ TEST_F(RlzLibTest, OmniboxUsageAfterDelayedInit) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, true);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -542,6 +614,11 @@ TEST_F(RlzLibTest, OmniboxUsageSendsPingWhenSendPingImmediately) {
ExpectEventRecorded(kHomepageSetToGoogle, true);
ExpectEventRecorded(kHomepageFirstSeach, false);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, true);
+ ExpectEventRecorded(kApplistSetToGoogle, true);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(true);
}
@@ -559,6 +636,11 @@ TEST_F(RlzLibTest, HomepageUsageDoesNotSendPingWhenSendPingImmediately) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, false);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(false);
}
@@ -576,6 +658,11 @@ TEST_F(RlzLibTest, StartupUsageDoesNotSendPingWhenSendPingImmediately) {
ExpectEventRecorded(kHomepageSetToGoogle, false);
ExpectEventRecorded(kHomepageFirstSeach, true);
+ // App list events.
+ ExpectEventRecorded(kApplistInstall, false);
+ ExpectEventRecorded(kApplistSetToGoogle, false);
+ ExpectEventRecorded(kApplistFirstSearch, false);
+
ExpectRlzPingSent(false);
}
@@ -622,6 +709,7 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) {
// Set dummy RLZ string.
rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString);
rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, kHomepageRlzString);
+ rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST, kApplistRlzString);
base::string16 rlz;
@@ -633,6 +721,8 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) {
EXPECT_TRUE(RLZTracker::GetAccessPointRlz(
RLZTracker::CHROME_HOME_PAGE, &rlz));
EXPECT_STREQ(kHomepageRlzString, base::UTF16ToUTF8(rlz).c_str());
+ EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz));
+ EXPECT_STREQ(kApplistRlzString, base::UTF16ToUTF8(rlz).c_str());
// Make sure cache is valid.
tracker_.set_assume_not_ui_thread(false);
@@ -642,6 +732,8 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) {
EXPECT_TRUE(RLZTracker::GetAccessPointRlz(
RLZTracker::CHROME_HOME_PAGE, &rlz));
EXPECT_STREQ(kHomepageRlzString, base::UTF16ToUTF8(rlz).c_str());
+ EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz));
+ EXPECT_STREQ(kApplistRlzString, base::UTF16ToUTF8(rlz).c_str());
// Perform ping.
tracker_.set_assume_not_ui_thread(true);
@@ -657,6 +749,8 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) {
EXPECT_TRUE(RLZTracker::GetAccessPointRlz(
RLZTracker::CHROME_HOME_PAGE, &rlz));
EXPECT_STREQ(kNewHomepageRlzString, base::UTF16ToUTF8(rlz).c_str());
+ EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz));
+ EXPECT_STREQ(kNewApplistRlzString, base::UTF16ToUTF8(rlz).c_str());
}
TEST_F(RlzLibTest, ObserveHandlesBadArgs) {

Powered by Google App Engine
This is Rietveld 408576698