| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/domain_reliability/config.h" | 5 #include "components/domain_reliability/config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 config->resources.push_back(resource); | 73 config->resources.push_back(resource); |
| 74 | 74 |
| 75 EXPECT_TRUE(config->IsValid()); | 75 EXPECT_TRUE(config->IsValid()); |
| 76 return config.Pass(); | 76 return config.Pass(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 int GetIndex(DomainReliabilityConfig* config, const char* url_string) { | 79 int GetIndex(DomainReliabilityConfig* config, const char* url_string) { |
| 80 return config->GetResourceIndexForUrl(GURL(url_string)); | 80 return config->GetResourceIndexForUrl(GURL(url_string)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | |
| 84 | |
| 85 class DomainReliabilityConfigTest : public testing::Test { }; | 83 class DomainReliabilityConfigTest : public testing::Test { }; |
| 86 | 84 |
| 87 TEST_F(DomainReliabilityConfigTest, IsValid) { | 85 TEST_F(DomainReliabilityConfigTest, IsValid) { |
| 88 scoped_ptr<DomainReliabilityConfig> config; | 86 scoped_ptr<DomainReliabilityConfig> config; |
| 89 | 87 |
| 90 config = MakeSampleConfig(); | 88 config = MakeSampleConfig(); |
| 91 EXPECT_TRUE(config->IsValid()); | 89 EXPECT_TRUE(config->IsValid()); |
| 92 | 90 |
| 93 config = MakeSampleConfig(); | 91 config = MakeSampleConfig(); |
| 94 config->domain = ""; | 92 config->domain = ""; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 EXPECT_EQ("home", config->resources[0]->name); | 200 EXPECT_EQ("home", config->resources[0]->name); |
| 203 EXPECT_EQ(1u, config->resources[0]->url_patterns.size()); | 201 EXPECT_EQ(1u, config->resources[0]->url_patterns.size()); |
| 204 EXPECT_EQ("http://test.example/", *(config->resources[0]->url_patterns[0])); | 202 EXPECT_EQ("http://test.example/", *(config->resources[0]->url_patterns[0])); |
| 205 EXPECT_EQ(0.01, config->resources[0]->success_sample_rate); | 203 EXPECT_EQ(0.01, config->resources[0]->success_sample_rate); |
| 206 EXPECT_EQ(0.10, config->resources[0]->failure_sample_rate); | 204 EXPECT_EQ(0.10, config->resources[0]->failure_sample_rate); |
| 207 EXPECT_EQ(1u, config->collectors.size()); | 205 EXPECT_EQ(1u, config->collectors.size()); |
| 208 EXPECT_EQ(GURL("https://test.example/domrel/upload"), | 206 EXPECT_EQ(GURL("https://test.example/domrel/upload"), |
| 209 config->collectors[0]->upload_url); | 207 config->collectors[0]->upload_url); |
| 210 } | 208 } |
| 211 | 209 |
| 210 } // namespace |
| 212 } // namespace domain_reliability | 211 } // namespace domain_reliability |
| OLD | NEW |