Index: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
index 8b0e950cf9281e073f3517ddde5e8c104775a625..1c5ddaab7fc0f2f5bb35c3b9fce1eb51318095bc 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
@@ -22,19 +22,35 @@ namespace { |
const char kChromeProxyHeader[] = "chrome-proxy"; |
const char kOtherProxy[] = "testproxy:17"; |
-const char kTestKey[] = "test-key"; |
+ |
+#if defined(OS_ANDROID) |
+ const char kClient[] = "android"; |
+#elif defined(OS_IOS) |
+ const char kClient[] = "ios"; |
+#else |
+ const char kClient[] = ""; |
+#endif |
const char kVersion[] = "0"; |
+const char kTestKey[] = "test-key"; |
const char kExpectedCredentials[] = "96bd72ec4a050ba60981743d41787768"; |
const char kExpectedSession[] = "0-1633771873-1633771873-1633771873"; |
const char kTestKey2[] = "test-key2"; |
-const char kClient2[] = "foo"; |
-const char kVersion2[] = "2"; |
const char kExpectedCredentials2[] = "c911fdb402f578787562cf7f00eda972"; |
const char kExpectedSession2[] = "0-1633771873-1633771873-1633771873"; |
+#if defined(OS_ANDROID) |
const char kExpectedHeader2[] = |
"ps=0-1633771873-1633771873-1633771873, " |
- "sid=c911fdb402f578787562cf7f00eda972, v=2, c=foo"; |
+ "sid=c911fdb402f578787562cf7f00eda972, v=0, c=android"; |
+#elif defined(OS_IOS) |
+const char kExpectedHeader2[] = |
+ "ps=0-1633771873-1633771873-1633771873, " |
+ "sid=c911fdb402f578787562cf7f00eda972, v=0, c=ios"; |
+#else |
+const char kExpectedHeader2[] = |
+ "ps=0-1633771873-1633771873-1633771873, " |
+ "sid=c911fdb402f578787562cf7f00eda972, v=0, c="; |
+#endif |
const char kDataReductionProxyKey[] = "12345"; |
} // namespace |
@@ -46,8 +62,10 @@ class TestDataReductionProxyAuthRequestHandler |
: public DataReductionProxyAuthRequestHandler { |
public: |
TestDataReductionProxyAuthRequestHandler( |
+ const std::string& client, |
+ const std::string& version, |
DataReductionProxyParams* params) |
- : DataReductionProxyAuthRequestHandler(params) {} |
+ : DataReductionProxyAuthRequestHandler(client,version, params) {} |
virtual std::string GetDefaultKey() const OVERRIDE { |
return kTestKey; |
@@ -79,24 +97,18 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) { |
DataReductionProxyParams::kPromoAllowed, |
TestDataReductionProxyParams::HAS_EVERYTHING & |
~TestDataReductionProxyParams::HAS_DEV_ORIGIN)); |
- TestDataReductionProxyAuthRequestHandler auth_handler(params.get()); |
+ TestDataReductionProxyAuthRequestHandler auth_handler(kClient, |
+ kVersion, |
+ params.get()); |
auth_handler.Init(); |
-#if defined(OS_ANDROID) |
- EXPECT_EQ(auth_handler.client_, "android"); |
-#elif defined(OS_IOS) |
- EXPECT_EQ(auth_handler.client_, "ios"); |
-#else |
- EXPECT_EQ(auth_handler.client_, ""); |
-#endif |
+ EXPECT_EQ(auth_handler.client_, kClient); |
EXPECT_EQ(kVersion, auth_handler.version_); |
EXPECT_EQ(auth_handler.key_, kTestKey); |
EXPECT_EQ(kExpectedCredentials, auth_handler.credentials_); |
EXPECT_EQ(kExpectedSession, auth_handler.session_); |
// Now set a key. |
- auth_handler.SetKey(kTestKey2, kClient2, kVersion2); |
- EXPECT_EQ(kClient2, auth_handler.client_); |
- EXPECT_EQ(kVersion2, auth_handler.version_); |
+ auth_handler.SetKey(kTestKey2); |
EXPECT_EQ(kTestKey2, auth_handler.key_); |
EXPECT_EQ(kExpectedCredentials2, auth_handler.credentials_); |
EXPECT_EQ(kExpectedSession2, auth_handler.session_); |