diff options
author | sdefresne@chromium.org <sdefresne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-17 18:10:32 +0000 |
---|---|---|
committer | sdefresne@chromium.org <sdefresne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-17 18:10:32 +0000 |
commit | 29f580249b14b54fd43544a2991746fde6780a4c (patch) | |
tree | b9dba638819f90db2e5853d8855c81733fa4ca7b /rlz | |
parent | 90963efa16f3f2e1da168fdca1872a638939aa51 (diff) | |
download | chromium_src-29f580249b14b54fd43544a2991746fde6780a4c.zip chromium_src-29f580249b14b54fd43544a2991746fde6780a4c.tar.gz chromium_src-29f580249b14b54fd43544a2991746fde6780a4c.tar.bz2 |
Use invalid value for GetAccessPointName for CHROME_IOS_RESERVED
The team that uses the RLZ access point does not want to reserve two
access points for Chrome on iOS since only one is currently used but
the enumeration rlz_lib::AccessPoint cannot be changed.
Mark the CHROME_IOS_RESERVED access point enumeration value as not
supported in IsAccessPointSupported (as we should never reference an
access point with enumeration value until the value is reused). This
fixes the code that iterates over all values in that enumeration in
FinancialPing::FormRequest when no events have been recorded.
Return an invalid value in GetAccessPointName if called with the
enumeration value rlz_lib::AccessPoint instead of returning NULL to
avoid a crash on Chrome OS (constructing a std::string from NULL crash
in strlen on Chrome OS).
BUG=360686,363700
Review URL: https://codereview.chromium.org/239053004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'rlz')
-rw-r--r-- | rlz/lib/lib_values.cc | 5 | ||||
-rw-r--r-- | rlz/lib/lib_values_unittest.cc | 7 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.cc | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/rlz/lib/lib_values.cc b/rlz/lib/lib_values.cc index 06113a8..80e987a 100644 --- a/rlz/lib/lib_values.cc +++ b/rlz/lib/lib_values.cc @@ -99,7 +99,10 @@ const char* GetAccessPointName(AccessPoint point) { case CHROMEOS_HOME_PAGE: return "CB"; case CHROMEOS_APP_LIST: return "CC"; case CHROME_IOS_OMNIBOX: return "C9"; - case CHROME_IOS_RESERVED: return "C0"; + // Returns an invalid access point value here as this value does not + // correspond to a defined access point, but need to be defined for + // code that iterates over all values of rlz_lib::AccessPoint. + case CHROME_IOS_RESERVED: return "__"; case CHROME_APP_LIST: return "C7"; case CHROME_MAC_APP_LIST: return "C8"; case UNDEFINED_AP_Q: return "RQ"; diff --git a/rlz/lib/lib_values_unittest.cc b/rlz/lib/lib_values_unittest.cc index 7e8fa83..3fcda4f 100644 --- a/rlz/lib/lib_values_unittest.cc +++ b/rlz/lib/lib_values_unittest.cc @@ -32,8 +32,13 @@ TEST(LibValuesUnittest, GetAccessPointFromName) { EXPECT_FALSE(rlz_lib::GetAccessPointFromName("T4 ", &point)); EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point); -} + for (int ap = rlz_lib::NO_ACCESS_POINT + 1; + ap < rlz_lib::LAST_ACCESS_POINT; ++ap) { + rlz_lib::AccessPoint point = static_cast<rlz_lib::AccessPoint>(ap); + EXPECT_TRUE(GetAccessPointName(point) != NULL); + } +} TEST(LibValuesUnittest, GetEventFromName) { rlz_lib::SetExpectedAssertion("GetEventFromName: event is NULL"); diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index 39bec27..95e3e09 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -30,6 +30,7 @@ bool IsAccessPointSupported(rlz_lib::AccessPoint point) { switch (point) { case rlz_lib::NO_ACCESS_POINT: case rlz_lib::LAST_ACCESS_POINT: + case rlz_lib::CHROME_IOS_RESERVED: case rlz_lib::MOBILE_IDLE_SCREEN_BLACKBERRY: case rlz_lib::MOBILE_IDLE_SCREEN_WINMOB: |