| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc
|
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc
|
| index 4b2f79bc55a06226ed932230123e07f86b31fa6e..b3339f201b4037964acfbb71c9182d4ceba2f041 100644
|
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc
|
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc
|
| @@ -25,8 +25,10 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "url/gurl.h"
|
|
|
| -const char kDataReductionProxyOrigin[] = "https://foo:443/";
|
| -const char kDataReductionProxyOriginHostPort[] = "foo:443";
|
| +const char kDataReductionProxyOrigin[] = "https://foo.com:443/";
|
| +const char kDataReductionProxyOriginPAC[] = "HTTPS foo.com:443;";
|
| +const char kDataReductionProxyFallback[] = "http://bar.com:80/";
|
| +const char kDataReductionProxyFallbackPAC[] = "HTTP bar.com:80;";
|
| const char kDataReductionProxyAuth[] = "12345";
|
|
|
| class TestDataReductionProxySettingsAndroid
|
| @@ -56,10 +58,19 @@ class TestDataReductionProxySettingsAndroid
|
| virtual PrefService* GetOriginalProfilePrefs() OVERRIDE {
|
| return profile_prefs_;
|
| }
|
| +
|
| virtual PrefService* GetLocalStatePrefs() OVERRIDE {
|
| return local_state_prefs_;
|
| }
|
|
|
| + virtual std::string GetDefaultProxyHost() OVERRIDE {
|
| + return std::string();
|
| + }
|
| +
|
| + virtual std::string GetDefaultFallbackProxyHost() OVERRIDE {
|
| + return std::string();
|
| + }
|
| +
|
| void set_probe_result(const std::string& test_url,
|
| const std::string& response,
|
| bool success) {
|
| @@ -132,33 +143,6 @@ TEST_F(DataReductionProxySettingsAndroidTest, TestGetDataReductionProxyOrigin) {
|
| EXPECT_EQ(kDataReductionProxyOrigin, ConvertJavaStringToUTF8(str_ref));
|
| }
|
|
|
| -TEST_F(DataReductionProxySettingsAndroidTest, TestGetDataReductionProxyAuth) {
|
| - AddProxyToCommandLine();
|
| - // SetUp() adds the auth string to the command line, which should be returned
|
| - // here.
|
| - ScopedJavaLocalRef<jstring> result =
|
| - settings_->GetDataReductionProxyAuth(env_, NULL);
|
| - ASSERT_TRUE(result.obj());
|
| - const base::android::JavaRef<jstring>& str_ref = result;
|
| - EXPECT_EQ(kDataReductionProxyAuth, ConvertJavaStringToUTF8(str_ref));
|
| -}
|
| -
|
| -// Test that the auth value set by preprocessor directive is not returned
|
| -// when an origin is set via a switch. This test only does anything useful in
|
| -// Chrome builds.
|
| -TEST_F(DataReductionProxySettingsAndroidTest,
|
| - TestGetDataReductionProxyAuthWithOriginSetViaSwitch) {
|
| - CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kSpdyProxyAuthOrigin, kDataReductionProxyOrigin);
|
| - // SetUp() adds the auth string to the command line, which should be returned
|
| - // here.
|
| - ScopedJavaLocalRef<jstring> result =
|
| - settings_->GetDataReductionProxyAuth(env_, NULL);
|
| - ASSERT_TRUE(result.obj());
|
| - const base::android::JavaRef<jstring>& str_ref = result;
|
| - EXPECT_EQ(std::string(), ConvertJavaStringToUTF8(str_ref));
|
| -}
|
| -
|
| // Confirm that the bypass rule functions generate the intended JavaScript
|
| // code for the Proxy PAC.
|
| TEST_F(DataReductionProxySettingsAndroidTest, TestBypassPACRules) {
|
| @@ -174,9 +158,13 @@ TEST_F(DataReductionProxySettingsAndroidTest, TestBypassPACRules) {
|
| }
|
|
|
| TEST_F(DataReductionProxySettingsAndroidTest, TestSetProxyPac) {
|
| + AddProxyToCommandLine();
|
| settings_->AddDefaultProxyBypassRules();
|
| + std::string raw_pac = settings_->GetProxyPacScript();
|
| + EXPECT_NE(raw_pac.find(kDataReductionProxyOriginPAC), std::string::npos);
|
| + EXPECT_NE(raw_pac.find(kDataReductionProxyFallbackPAC), std::string::npos);;
|
| std::string pac;
|
| - base::Base64Encode(settings_->GetProxyPacScript(), &pac);
|
| + base::Base64Encode(raw_pac, &pac);
|
| std::string expected_pac_url =
|
| "data:application/x-ns-proxy-autoconfig;base64," + pac;
|
| // Test setting the PAC, without generating histograms.
|
|
|