Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_client_unittest.cc |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_client_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_client_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0e1fb76a65a11f28a5540a9349f6a6c50ed90b1e |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_client_unittest.cc |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_client.h" |
| + |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/values.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" |
| +#include "components/data_reduction_proxy/core/common/client_config_parser.h" |
| +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" |
| +#include "components/data_reduction_proxy/proto/client_config.pb.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace data_reduction_proxy { |
| + |
| +class DataReductionProxyConfigClientTest : public testing::Test { |
| + protected: |
| + void SetUp() override { |
| + test_context_ = |
| + DataReductionProxyTestContext::Builder() |
| + .WithParamsFlags(DataReductionProxyParams::kAllowed | |
| + DataReductionProxyParams::kFallbackAllowed | |
| + DataReductionProxyParams::kPromoAllowed) |
| + .WithParamsDefinitions(TestDataReductionProxyParams::HAS_EVERYTHING) |
| + .Build(); |
| + } |
| + |
| + scoped_ptr<DataReductionProxyConfigClient> BuildConfigClient() { |
| + return make_scoped_ptr(new DataReductionProxyConfigClient( |
| + test_context_->config()->test_params(), |
| + test_context_->io_data()->request_options())); |
| + } |
| + |
| + private: |
| + scoped_ptr<DataReductionProxyTestContext> test_context_; |
| +}; |
| + |
| +TEST_F(DataReductionProxyConfigClientTest, TestConstructStaticResponse) { |
| + scoped_ptr<DataReductionProxyConfigClient> config_client = |
| + BuildConfigClient(); |
| + std::string config_data = config_client->ConstructStaticResponse(); |
| + ClientConfig config; |
| + EXPECT_TRUE(ParseClientConfig(config_data, &config)); |
|
bengr
2015/03/19 16:31:14
Maybe also add a test that expects false on a bogu
jeremyim
2015/03/20 16:21:11
ParseClientConfig already has a decent set of test
|
| +} |
| + |
| +} // namespace data_reduction_proxy |