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

Unified Diff: mock_http_fetcher.h

Issue 4432002: AU: Separate error codes for different OmahaRequestAction failures. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « action_processor.h ('k') | mock_http_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mock_http_fetcher.h
diff --git a/mock_http_fetcher.h b/mock_http_fetcher.h
index f0830f0c553ee7b670c055e94159d9d1b5495cda..dfe61a73cd836146fe491290b93f2cdf07c54d7b 100644
--- a/mock_http_fetcher.h
+++ b/mock_http_fetcher.h
@@ -27,7 +27,11 @@ class MockHttpFetcher : public HttpFetcher {
// The data passed in here is copied and then passed to the delegate after
// the transfer begins.
MockHttpFetcher(const char* data, size_t size)
- : sent_size_(0), timeout_source_(NULL), timout_tag_(0), paused_(false) {
+ : sent_size_(0),
+ timeout_source_(NULL),
+ timout_tag_(0),
+ paused_(false),
+ fail_transfer_(false) {
data_.insert(data_.end(), data, data + size);
}
@@ -55,7 +59,7 @@ class MockHttpFetcher : public HttpFetcher {
virtual void Unpause();
// Fail the transfer. This simulates a network failure.
- void FailTransfer();
+ void FailTransfer(int http_response_code);
const std::vector<char>& post_data() const {
return post_data_;
@@ -76,6 +80,10 @@ class MockHttpFetcher : public HttpFetcher {
return reinterpret_cast<MockHttpFetcher*>(data)->TimeoutCallback();
}
+ // Sets the HTTP response code and signals to the delegate that the transfer
+ // is complete.
+ void SignalTransferComplete();
+
// A full copy of the data we'll return to the delegate
std::vector<char> data_;
@@ -92,6 +100,9 @@ class MockHttpFetcher : public HttpFetcher {
// True iff the fetcher is paused.
bool paused_;
+ // Set to true if the transfer should fail.
+ bool fail_transfer_;
+
DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher);
};
« no previous file with comments | « action_processor.h ('k') | mock_http_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698