| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
| 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 .SkipSettingsInitialization() | 41 .SkipSettingsInitialization() |
| 42 .Build(); | 42 .Build(); |
| 43 config_ = test_context_->mock_config(); | 43 config_ = test_context_->mock_config(); |
| 44 drp_chrome_settings_->ResetConfigForTest(config_); | 44 drp_chrome_settings_->ResetConfigForTest(config_); |
| 45 dict_ = make_scoped_ptr(new base::DictionaryValue()); | 45 dict_ = make_scoped_ptr(new base::DictionaryValue()); |
| 46 | 46 |
| 47 PrefRegistrySimple* registry = test_context_->pref_service()->registry(); | 47 PrefRegistrySimple* registry = test_context_->pref_service()->registry(); |
| 48 registry->RegisterDictionaryPref(prefs::kProxy); | 48 registry->RegisterDictionaryPref(prefs::kProxy); |
| 49 } | 49 } |
| 50 | 50 |
| 51 base::MessageLoopForIO message_loop_; |
| 51 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; | 52 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; |
| 52 scoped_ptr<base::DictionaryValue> dict_; | 53 scoped_ptr<base::DictionaryValue> dict_; |
| 53 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> test_context_; | 54 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> test_context_; |
| 54 data_reduction_proxy::MockDataReductionProxyConfig* config_; | 55 data_reduction_proxy::MockDataReductionProxyConfig* config_; |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) { | 58 TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) { |
| 58 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); | 59 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); |
| 59 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( | 60 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( |
| 60 test_context_->pref_service()); | 61 test_context_->pref_service()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::DictionaryValue* value = | 100 base::DictionaryValue* value = |
| 100 (base::DictionaryValue*)test_context_->pref_service()->GetUserPref( | 101 (base::DictionaryValue*)test_context_->pref_service()->GetUserPref( |
| 101 prefs::kProxy); | 102 prefs::kProxy); |
| 102 std::string mode; | 103 std::string mode; |
| 103 EXPECT_TRUE(value->GetString("mode", &mode)); | 104 EXPECT_TRUE(value->GetString("mode", &mode)); |
| 104 EXPECT_EQ("fixed_servers", mode); | 105 EXPECT_EQ("fixed_servers", mode); |
| 105 std::string server; | 106 std::string server; |
| 106 EXPECT_TRUE(value->GetString("server", &server)); | 107 EXPECT_TRUE(value->GetString("server", &server)); |
| 107 EXPECT_EQ("http=https://youtube.com", server); | 108 EXPECT_EQ("http=https://youtube.com", server); |
| 108 } | 109 } |
| OLD | NEW |