Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/test/histogram_tester.h" 11 #include "base/test/histogram_tester.h"
12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig_test_utils.h" 12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig_test_utils.h"
13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h" 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h"
14 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 14 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s_test_utils.h" 15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s_test_utils.h"
16 #include "components/prefs/pref_registry_simple.h" 16 #include "components/prefs/pref_registry_simple.h"
17 #include "components/prefs/testing_pref_service.h" 17 #include "components/prefs/testing_pref_service.h"
18 #include "components/proxy_config/proxy_config_pref_names.h" 18 #include "components/proxy_config/proxy_config_pref_names.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 using testing::_; 21 using testing::_;
22 using testing::Return; 22 using testing::Return;
23 23
24 class DataReductionProxyChromeSettingsTest : public testing::Test { 24 class DataReductionProxyChromeSettingsTest : public testing::Test {
25 public: 25 public:
26 void SetUp() override { 26 void SetUp() override {
27 drp_chrome_settings_ = 27 drp_chrome_settings_ = base::MakeUnique<DataReductionProxyChromeSettings>();
28 base::WrapUnique(new DataReductionProxyChromeSettings());
29 test_context_ = 28 test_context_ =
30 data_reduction_proxy::DataReductionProxyTestContext::Builder() 29 data_reduction_proxy::DataReductionProxyTestContext::Builder()
31 .WithMockConfig() 30 .WithMockConfig()
32 .SkipSettingsInitialization() 31 .SkipSettingsInitialization()
33 .Build(); 32 .Build();
34 config_ = test_context_->mock_config(); 33 config_ = test_context_->mock_config();
35 drp_chrome_settings_->ResetConfigForTest(config_); 34 drp_chrome_settings_->ResetConfigForTest(config_);
36 dict_ = base::WrapUnique(new base::DictionaryValue()); 35 dict_ = base::MakeUnique<base::DictionaryValue>();
37 36
38 PrefRegistrySimple* registry = test_context_->pref_service()->registry(); 37 PrefRegistrySimple* registry = test_context_->pref_service()->registry();
39 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy); 38 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy);
40 } 39 }
41 40
42 base::MessageLoopForIO message_loop_; 41 base::MessageLoopForIO message_loop_;
43 std::unique_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; 42 std::unique_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_;
44 std::unique_ptr<base::DictionaryValue> dict_; 43 std::unique_ptr<base::DictionaryValue> dict_;
45 std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext> 44 std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext>
46 test_context_; 45 test_context_;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 EXPECT_EQ("fixed_servers", mode); 329 EXPECT_EQ("fixed_servers", mode);
331 std::string server; 330 std::string server;
332 EXPECT_TRUE(value->GetString("server", &server)); 331 EXPECT_TRUE(value->GetString("server", &server));
333 EXPECT_EQ(test_server, server); 332 EXPECT_EQ(test_server, server);
334 333
335 histogram_tester.ExpectUniqueSample( 334 histogram_tester.ExpectUniqueSample(
336 "DataReductionProxy.ProxyPrefMigrationResult", 335 "DataReductionProxy.ProxyPrefMigrationResult",
337 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1); 336 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
338 } 337 }
339 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698