Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Side by Side Diff: components/domain_reliability/uploader_unittest.cc

Issue 1164823002: Remove URLRequestStatus mutators and introduce FromError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/uploader.h" 5 #include "components/domain_reliability/uploader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <map> 9 #include <map>
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers)))); 85 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers))));
86 fetcher->SetResponseString(""); 86 fetcher->SetResponseString("");
87 fetcher->delegate()->OnURLFetchComplete(fetcher); 87 fetcher->delegate()->OnURLFetchComplete(fetcher);
88 } 88 }
89 89
90 void SimulateUploadError(int error) { 90 void SimulateUploadError(int error) {
91 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 91 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
92 EXPECT_TRUE(fetcher); 92 EXPECT_TRUE(fetcher);
93 93
94 net::URLRequestStatus status; 94 net::URLRequestStatus status;
95 status.set_status(net::URLRequestStatus::FAILED); 95 fetcher->set_status(net::URLRequestStatus::FromError(error));
96 status.set_error(error);
97 fetcher->set_status(status);
98 fetcher->set_response_code(-1); 96 fetcher->set_response_code(-1);
99 fetcher->delegate()->OnURLFetchComplete(fetcher); 97 fetcher->delegate()->OnURLFetchComplete(fetcher);
100 } 98 }
101 99
102 scoped_refptr<base::TestSimpleTaskRunner> network_task_runner_; 100 scoped_refptr<base::TestSimpleTaskRunner> network_task_runner_;
103 net::TestURLFetcherFactory url_fetcher_factory_; 101 net::TestURLFetcherFactory url_fetcher_factory_;
104 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; 102 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
105 MockTime time_; 103 MockTime time_;
106 scoped_ptr<DomainReliabilityUploader> uploader_; 104 scoped_ptr<DomainReliabilityUploader> uploader_;
107 105
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 151 }
154 152
155 TEST_F(DomainReliabilityUploaderTest, DiscardedUpload) { 153 TEST_F(DomainReliabilityUploaderTest, DiscardedUpload) {
156 uploader_->set_discard_uploads(true); 154 uploader_->set_discard_uploads(true);
157 SimulateUpload(); 155 SimulateUpload();
158 SimulateNoUploadRequest(); 156 SimulateNoUploadRequest();
159 } 157 }
160 158
161 } // namespace 159 } // namespace
162 } // namespace domain_reliability 160 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698