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

Unified Diff: components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc

Issue 1004853002: Create abstraction for DataReductionProxyParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sclittle comments Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
index dbf5bb5ea055683d0f1b244cc174ee28eda5c13b..cca6bfaa482dd313a3f89c2b7d217db499d4cacd 100644
--- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc
@@ -19,6 +19,7 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_test_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -69,6 +70,7 @@ class DataReductionProxyDebugResourceThrottleTest : public testing::Test {
DataReductionProxyTestContext::Builder()
.WithParamsFlags(DataReductionProxyParams::kAllowed)
.WithParamsDefinitions(TestDataReductionProxyParams::HAS_EVERYTHING)
+ .WithMockConfig()
.Build();
request_ = context_.CreateRequest(GURL("http://www.google.com/"), net::IDLE,
&delegate_, NULL);
@@ -90,8 +92,8 @@ class DataReductionProxyDebugResourceThrottleTest : public testing::Test {
}
protected:
- TestDataReductionProxyParams* params() const {
- return test_context_->config()->test_params();
+ MockDataReductionProxyConfig* config() const {
+ return test_context_->mock_config();
}
TestDataReductionProxyDebugResourceThrottle* throttle() const {
@@ -121,20 +123,40 @@ class DataReductionProxyDebugResourceThrottleTest : public testing::Test {
// on the client (even when the proxy has already been bypassed by the server).
TEST_F(DataReductionProxyDebugResourceThrottleTest, WillStartUsingNetwork) {
bool defer = false;
- params()->MockAreDataReductionProxiesBypassed(false);
+ EXPECT_CALL(
+ *config(), AreDataReductionProxiesBypassed(
+ testing::_, testing::_, testing::_))
+ .Times(1)
+ .WillOnce(testing::Return(false));
throttle()->WillStartUsingNetwork(&defer);
EXPECT_FALSE(defer);
- params()->MockAreDataReductionProxiesBypassed(true);
- params()->MockIsBypassedByDataReductionProxyLocalRules(false);
+ EXPECT_CALL(
+ *config(), AreDataReductionProxiesBypassed(
+ testing::_, testing::_, testing::_))
+ .Times(1)
+ .WillOnce(testing::Return(true));
+ EXPECT_CALL(
+ *config(), IsBypassedByDataReductionProxyLocalRules(
+ testing::_, testing::_))
+ .Times(1)
+ .WillOnce(testing::Return(false));
throttle()->WillStartUsingNetwork(&defer);
EXPECT_TRUE(defer);
// Must be tested last because this sets |state_| of |resource_throttle_|
// to LOCAL_BYPASS.
defer = false;
- params()->MockAreDataReductionProxiesBypassed(true);
- params()->MockIsBypassedByDataReductionProxyLocalRules(true);
+ EXPECT_CALL(
+ *config(), AreDataReductionProxiesBypassed(
+ testing::_, testing::_, testing::_))
+ .Times(1)
+ .WillOnce(testing::Return(true));
+ EXPECT_CALL(
+ *config(), IsBypassedByDataReductionProxyLocalRules(
+ testing::_, testing::_))
+ .Times(1)
+ .WillOnce(testing::Return(true));
throttle()->WillStartUsingNetwork(&defer);
EXPECT_FALSE(defer);
}
« no previous file with comments | « components/data_reduction_proxy.gypi ('k') | components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698