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

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

Issue 896713003: Revert of DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_settings_android.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
15 #include "base/test/test_simple_task_runner.h"
16 #include "base/time/time.h"
17 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 13 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
18 #include "chrome/browser/prefs/proxy_prefs.h" 14 #include "chrome/browser/prefs/proxy_prefs.h"
19 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings_test_utils.h" 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings_test_utils.h"
22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h"
23 #include "net/proxy/proxy_server.h" 18 #include "net/proxy/proxy_server.h"
24 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
26 #include "url/gurl.h" 21 #include "url/gurl.h"
27 22
28 using testing::_; 23 using testing::_;
29 using testing::AnyNumber; 24 using testing::AnyNumber;
30 using testing::Return; 25 using testing::Return;
31 26
32 const char kDataReductionProxyDev[] = "foo-dev.com:80"; 27 const char kDataReductionProxyDev[] = "foo-dev.com:80";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 new MockDataReductionProxySettings<C>(flags); 68 new MockDataReductionProxySettings<C>(flags);
74 EXPECT_CALL(*settings, GetOriginalProfilePrefs()) 69 EXPECT_CALL(*settings, GetOriginalProfilePrefs())
75 .Times(AnyNumber()) 70 .Times(AnyNumber())
76 .WillRepeatedly(Return(&pref_service_)); 71 .WillRepeatedly(Return(&pref_service_));
77 EXPECT_CALL(*settings, GetLocalStatePrefs()) 72 EXPECT_CALL(*settings, GetLocalStatePrefs())
78 .Times(AnyNumber()) 73 .Times(AnyNumber())
79 .WillRepeatedly(Return(&pref_service_)); 74 .WillRepeatedly(Return(&pref_service_));
80 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); 75 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0);
81 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0); 76 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0);
82 settings_.reset(settings); 77 settings_.reset(settings);
83 settings_->SetDataReductionProxyStatisticsPrefs( 78 settings_->SetDataReductionProxyStatisticsPrefs(statistics_prefs_.get());
84 scoped_ptr<DataReductionProxyStatisticsPrefs>(
85 new DataReductionProxyStatisticsPrefs(
86 &pref_service_,
87 scoped_refptr<base::TestSimpleTaskRunner>(
88 new base::TestSimpleTaskRunner()),
89 base::TimeDelta())));
90 } 79 }
91 80
92 template <class C> 81 template <class C>
93 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult( 82 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult(
94 const std::string& test_url, 83 const std::string& test_url,
95 const std::string& response, 84 const std::string& response,
96 ProbeURLFetchResult result, 85 ProbeURLFetchResult result,
97 bool success, 86 bool success,
98 int expected_calls) { 87 int expected_calls) {
99 MockDataReductionProxySettings<C>* settings = 88 MockDataReductionProxySettings<C>* settings =
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 186
198 jlong value; 187 jlong value;
199 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { 188 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) {
200 env_->GetLongArrayRegion(result.obj(), i, 1, &value); 189 env_->GetLongArrayRegion(result.obj(), i, 1, &value);
201 ASSERT_EQ( 190 ASSERT_EQ(
202 static_cast<long>( 191 static_cast<long>(
203 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); 192 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value);
204 } 193 }
205 } 194 }
206 195
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698