| Index: components/domain_reliability/context_unittest.cc
|
| diff --git a/components/domain_reliability/context_unittest.cc b/components/domain_reliability/context_unittest.cc
|
| index 56b62a1f19024c8f8f65170312ba403e5dc57c4d..f98b5ca03207317e64928daac04b9d87a58a42ba 100644
|
| --- a/components/domain_reliability/context_unittest.cc
|
| +++ b/components/domain_reliability/context_unittest.cc
|
| @@ -18,7 +18,6 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace domain_reliability {
|
| -
|
| namespace {
|
|
|
| typedef std::vector<DomainReliabilityBeacon> BeaconVector;
|
| @@ -45,6 +44,7 @@ class DomainReliabilityContextTest : public testing::Test {
|
| base::Unretained(this))),
|
| context_(&time_,
|
| params_,
|
| + "test-reporter",
|
| &dispatcher_,
|
| &uploader_,
|
| CreateConfig().Pass()),
|
| @@ -73,14 +73,16 @@ class DomainReliabilityContextTest : public testing::Test {
|
| upload_pending_ = false;
|
| }
|
|
|
| - bool CheckNoBeacons(int index) {
|
| + bool CheckNoBeacons(size_t index) {
|
| BeaconVector beacons;
|
| context_.GetQueuedDataForTesting(index, &beacons, NULL, NULL);
|
| return beacons.empty();
|
| }
|
|
|
| - bool CheckCounts(int index, int expected_successful, int expected_failed) {
|
| - int successful, failed;
|
| + bool CheckCounts(size_t index,
|
| + unsigned expected_successful,
|
| + unsigned expected_failed) {
|
| + unsigned successful, failed;
|
| context_.GetQueuedDataForTesting(index, NULL, &successful, &failed);
|
| return successful == expected_successful && failed == expected_failed;
|
| }
|
| @@ -153,8 +155,9 @@ TEST_F(DomainReliabilityContextTest, Create) {
|
| }
|
|
|
| TEST_F(DomainReliabilityContextTest, NoResource) {
|
| + GURL url("http://example/no_resource");
|
| DomainReliabilityBeacon beacon = MakeBeacon(&time_);
|
| - context_.AddBeacon(beacon, GURL("http://example/no_resource"));
|
| + context_.OnBeacon(url, beacon);
|
|
|
| EXPECT_TRUE(CheckNoBeacons(0));
|
| EXPECT_TRUE(CheckCounts(0, 0, 0));
|
| @@ -163,8 +166,9 @@ TEST_F(DomainReliabilityContextTest, NoResource) {
|
| }
|
|
|
| TEST_F(DomainReliabilityContextTest, NeverReport) {
|
| + GURL url("http://example/never_report");
|
| DomainReliabilityBeacon beacon = MakeBeacon(&time_);
|
| - context_.AddBeacon(beacon, GURL("http://example/never_report"));
|
| + context_.OnBeacon(url, beacon);
|
|
|
| EXPECT_TRUE(CheckNoBeacons(0));
|
| EXPECT_TRUE(CheckCounts(0, 0, 0));
|
| @@ -173,8 +177,9 @@ TEST_F(DomainReliabilityContextTest, NeverReport) {
|
| }
|
|
|
| TEST_F(DomainReliabilityContextTest, AlwaysReport) {
|
| + GURL url("http://example/always_report");
|
| DomainReliabilityBeacon beacon = MakeBeacon(&time_);
|
| - context_.AddBeacon(beacon, GURL("http://example/always_report"));
|
| + context_.OnBeacon(url, beacon);
|
|
|
| BeaconVector beacons;
|
| context_.GetQueuedDataForTesting(0, &beacons, NULL, NULL);
|
| @@ -185,8 +190,9 @@ TEST_F(DomainReliabilityContextTest, AlwaysReport) {
|
| }
|
|
|
| TEST_F(DomainReliabilityContextTest, ReportUpload) {
|
| + GURL url("http://example/always_report");
|
| DomainReliabilityBeacon beacon = MakeBeacon(&time_);
|
| - context_.AddBeacon(beacon, GURL("http://example/always_report"));
|
| + context_.OnBeacon(url, beacon);
|
|
|
| const char* kExpectedReport = "{\"reporter\":\"chrome\","
|
| "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200,"
|
|
|