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

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: typo 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers)))); 84 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers))));
85 fetcher->SetResponseString(""); 85 fetcher->SetResponseString("");
86 fetcher->delegate()->OnURLFetchComplete(fetcher); 86 fetcher->delegate()->OnURLFetchComplete(fetcher);
87 } 87 }
88 88
89 void SimulateUploadError(int error) { 89 void SimulateUploadError(int error) {
90 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 90 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
91 EXPECT_TRUE(fetcher); 91 EXPECT_TRUE(fetcher);
92 92
93 net::URLRequestStatus status; 93 net::URLRequestStatus status;
94 status.set_status(net::URLRequestStatus::FAILED); 94 fetcher->set_status(net::URLRequestStatus::FromError(error));
95 status.set_error(error);
96 fetcher->set_status(status);
97 fetcher->set_response_code(-1); 95 fetcher->set_response_code(-1);
98 fetcher->delegate()->OnURLFetchComplete(fetcher); 96 fetcher->delegate()->OnURLFetchComplete(fetcher);
99 } 97 }
100 98
101 scoped_refptr<base::TestSimpleTaskRunner> network_task_runner_; 99 scoped_refptr<base::TestSimpleTaskRunner> network_task_runner_;
102 net::TestURLFetcherFactory url_fetcher_factory_; 100 net::TestURLFetcherFactory url_fetcher_factory_;
103 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; 101 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
104 MockTime time_; 102 MockTime time_;
105 scoped_ptr<DomainReliabilityUploader> uploader_; 103 scoped_ptr<DomainReliabilityUploader> uploader_;
106 104
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 150 }
153 151
154 TEST_F(DomainReliabilityUploaderTest, DiscardedUpload) { 152 TEST_F(DomainReliabilityUploaderTest, DiscardedUpload) {
155 uploader_->set_discard_uploads(true); 153 uploader_->set_discard_uploads(true);
156 SimulateUpload(); 154 SimulateUpload();
157 SimulateNoUploadRequest(); 155 SimulateNoUploadRequest();
158 } 156 }
159 157
160 } // namespace 158 } // namespace
161 } // namespace domain_reliability 159 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/monitor_unittest.cc ('k') | content/browser/loader/redirect_to_file_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698