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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 EXPECT_EQ("home", config->resources[0]->name); | 193 EXPECT_EQ("home", config->resources[0]->name); |
196 EXPECT_EQ(1u, config->resources[0]->url_patterns.size()); | 194 EXPECT_EQ(1u, config->resources[0]->url_patterns.size()); |
197 EXPECT_EQ("http://test.example/", *(config->resources[0]->url_patterns[0])); | 195 EXPECT_EQ("http://test.example/", *(config->resources[0]->url_patterns[0])); |
198 EXPECT_EQ(0.01, config->resources[0]->success_sample_rate); | 196 EXPECT_EQ(0.01, config->resources[0]->success_sample_rate); |
199 EXPECT_EQ(0.10, config->resources[0]->failure_sample_rate); | 197 EXPECT_EQ(0.10, config->resources[0]->failure_sample_rate); |
200 EXPECT_EQ(1u, config->collectors.size()); | 198 EXPECT_EQ(1u, config->collectors.size()); |
201 EXPECT_EQ(GURL("https://test.example/domrel/upload"), | 199 EXPECT_EQ(GURL("https://test.example/domrel/upload"), |
202 config->collectors[0]->upload_url); | 200 config->collectors[0]->upload_url); |
203 } | 201 } |
204 | 202 |
| 203 } // namespace |
205 } // namespace domain_reliability | 204 } // namespace domain_reliability |
OLD | NEW |