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

Side by Side Diff: mock_http_fetcher.cc

Issue 6677146: AU: OmahaRequestAction: allow to be skipped. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « mock_http_fetcher.h ('k') | omaha_request_action.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 "update_engine/mock_http_fetcher.h" 5 #include "update_engine/mock_http_fetcher.h"
6
6 #include <algorithm> 7 #include <algorithm>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gtest/gtest.h"
petkov 2011/04/04 23:33:28 I thought we were switching these to <>
adlr 2011/04/05 00:20:10 You're right. Changed to <>
8 11
9 // This is a mac implementation of HttpFetcher which is useful for testing. 12
13 // This is a mock implementation of HttpFetcher which is useful for testing.
10 14
11 using std::min; 15 using std::min;
12 16
13 namespace chromeos_update_engine { 17 namespace chromeos_update_engine {
14 18
15 MockHttpFetcher::~MockHttpFetcher() { 19 MockHttpFetcher::~MockHttpFetcher() {
16 CHECK(!timeout_source_) << "Call TerminateTransfer() before dtor."; 20 CHECK(!timeout_source_) << "Call TerminateTransfer() before dtor.";
17 } 21 }
18 22
19 void MockHttpFetcher::BeginTransfer(const std::string& url) { 23 void MockHttpFetcher::BeginTransfer(const std::string& url) {
24 EXPECT_FALSE(never_use_);
20 if (fail_transfer_ || data_.empty()) { 25 if (fail_transfer_ || data_.empty()) {
21 // No data to send, just notify of completion.. 26 // No data to send, just notify of completion..
22 SignalTransferComplete(); 27 SignalTransferComplete();
23 return; 28 return;
24 } 29 }
25 if (sent_size_ < data_.size()) 30 if (sent_size_ < data_.size())
26 SendData(true); 31 SendData(true);
27 } 32 }
28 33
29 // Returns false on one condition: If timeout_source_ was already set 34 // Returns false on one condition: If timeout_source_ was already set
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void MockHttpFetcher::SignalTransferComplete() { 129 void MockHttpFetcher::SignalTransferComplete() {
125 // If the transfer has been failed, the HTTP response code should be set 130 // If the transfer has been failed, the HTTP response code should be set
126 // already. 131 // already.
127 if (!fail_transfer_) { 132 if (!fail_transfer_) {
128 http_response_code_ = 200; 133 http_response_code_ = 200;
129 } 134 }
130 delegate_->TransferComplete(this, !fail_transfer_); 135 delegate_->TransferComplete(this, !fail_transfer_);
131 } 136 }
132 137
133 } // namespace chromeos_update_engine 138 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « mock_http_fetcher.h ('k') | omaha_request_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698