| 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" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 using base::DictionaryValue; | 14 using base::DictionaryValue; |
| 15 using data_reduction_proxy::DataReductionProxyParams; | 15 using data_reduction_proxy::DataReductionProxyParams; |
| 16 using data_reduction_proxy::DataReductionProxySettings; | 16 using data_reduction_proxy::DataReductionProxySettings; |
| 17 | 17 |
| 18 class DataReductionProxyChromeSettingsTest : public testing::Test { | 18 class DataReductionProxyChromeSettingsTest : public testing::Test { |
| 19 public: | 19 public: |
| 20 void SetUp() override { | 20 void SetUp() override { |
| 21 drp_chrome_settings_ = make_scoped_ptr(new DataReductionProxyChromeSettings( | 21 drp_chrome_settings_ = |
| 22 make_scoped_ptr(new DataReductionProxyParams(0)))); | 22 make_scoped_ptr(new DataReductionProxyChromeSettings()); |
| 23 dict_ = make_scoped_ptr(new DictionaryValue()); | 23 dict_ = make_scoped_ptr(new DictionaryValue()); |
| 24 mock_pref_service_ = make_scoped_ptr(new TestingPrefServiceSimple()); | 24 mock_pref_service_ = make_scoped_ptr(new TestingPrefServiceSimple()); |
| 25 | 25 |
| 26 PrefRegistrySimple* registry = mock_pref_service_->registry(); | 26 PrefRegistrySimple* registry = mock_pref_service_->registry(); |
| 27 registry->RegisterDictionaryPref(prefs::kProxy); | 27 registry->RegisterDictionaryPref(prefs::kProxy); |
| 28 } | 28 } |
| 29 | 29 |
| 30 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; | 30 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; |
| 31 scoped_ptr<base::DictionaryValue> dict_; | 31 scoped_ptr<base::DictionaryValue> dict_; |
| 32 scoped_ptr<TestingPrefServiceSimple> mock_pref_service_; | 32 scoped_ptr<TestingPrefServiceSimple> mock_pref_service_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 DictionaryValue* value = | 71 DictionaryValue* value = |
| 72 (DictionaryValue*)mock_pref_service_->GetUserPref(prefs::kProxy); | 72 (DictionaryValue*)mock_pref_service_->GetUserPref(prefs::kProxy); |
| 73 std::string mode; | 73 std::string mode; |
| 74 EXPECT_TRUE(value->GetString("mode", &mode)); | 74 EXPECT_TRUE(value->GetString("mode", &mode)); |
| 75 EXPECT_EQ("fixed_servers", mode); | 75 EXPECT_EQ("fixed_servers", mode); |
| 76 std::string server; | 76 std::string server; |
| 77 EXPECT_TRUE(value->GetString("server", &server)); | 77 EXPECT_TRUE(value->GetString("server", &server)); |
| 78 EXPECT_EQ("http=https://youtube.com", server); | 78 EXPECT_EQ("http=https://youtube.com", server); |
| 79 } | 79 } |
| OLD | NEW |