| 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/context.h" | 5 #include "components/domain_reliability/context.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "components/domain_reliability/dispatcher.h" | 13 #include "components/domain_reliability/dispatcher.h" |
| 14 #include "components/domain_reliability/scheduler.h" | 14 #include "components/domain_reliability/scheduler.h" |
| 15 #include "components/domain_reliability/test_util.h" | 15 #include "components/domain_reliability/test_util.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace domain_reliability { | 20 namespace domain_reliability { |
| 21 | |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 typedef std::vector<DomainReliabilityBeacon> BeaconVector; | 23 typedef std::vector<DomainReliabilityBeacon> BeaconVector; |
| 25 | 24 |
| 26 DomainReliabilityBeacon MakeBeacon(MockableTime* time) { | 25 DomainReliabilityBeacon MakeBeacon(MockableTime* time) { |
| 27 DomainReliabilityBeacon beacon; | 26 DomainReliabilityBeacon beacon; |
| 28 beacon.status = "ok"; | 27 beacon.status = "ok"; |
| 29 beacon.chrome_error = net::OK; | 28 beacon.chrome_error = net::OK; |
| 30 beacon.server_ip = "127.0.0.1"; | 29 beacon.server_ip = "127.0.0.1"; |
| 31 beacon.http_response_code = 200; | 30 beacon.http_response_code = 200; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 "\"never_report\",\"successful_requests\":0}]}"; | 196 "\"never_report\",\"successful_requests\":0}]}"; |
| 198 | 197 |
| 199 time_.Advance(max_delay()); | 198 time_.Advance(max_delay()); |
| 200 EXPECT_TRUE(upload_pending()); | 199 EXPECT_TRUE(upload_pending()); |
| 201 EXPECT_EQ(kExpectedReport, upload_report()); | 200 EXPECT_EQ(kExpectedReport, upload_report()); |
| 202 EXPECT_EQ(GURL("https://example/upload"), upload_url()); | 201 EXPECT_EQ(GURL("https://example/upload"), upload_url()); |
| 203 CallUploadCallback(true); | 202 CallUploadCallback(true); |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace domain_reliability | 205 } // namespace domain_reliability |
| OLD | NEW |