| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/http/http_transaction_unittest.h" | 5 #include "net/http/http_transaction_unittest.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 static const MockTransaction* const kBuiltinMockTransactions[] = { | 99 static const MockTransaction* const kBuiltinMockTransactions[] = { |
| 100 &kSimpleGET_Transaction, | 100 &kSimpleGET_Transaction, |
| 101 &kSimplePOST_Transaction, | 101 &kSimplePOST_Transaction, |
| 102 &kTypicalGET_Transaction, | 102 &kTypicalGET_Transaction, |
| 103 &kETagGET_Transaction, | 103 &kETagGET_Transaction, |
| 104 &kRangeGET_Transaction | 104 &kRangeGET_Transaction |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 typedef base::hash_map<std::string, const MockTransaction*> | 107 typedef base::hash_map<std::string, const MockTransaction*> |
| 108 MockTransactionMap; | 108 MockTransactionMap; |
| 109 static MockTransactionMap mock_transactions; | 109 static MockTransactionMap mock_transactions; |
| 110 | 110 |
| 111 void AddMockTransaction(const MockTransaction* trans) { | 111 void AddMockTransaction(const MockTransaction* trans) { |
| 112 mock_transactions[GURL(trans->url).spec()] = trans; | 112 mock_transactions[GURL(trans->url).spec()] = trans; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void RemoveMockTransaction(const MockTransaction* trans) { | 115 void RemoveMockTransaction(const MockTransaction* trans) { |
| 116 mock_transactions.erase(GURL(trans->url).spec()); | 116 mock_transactions.erase(GURL(trans->url).spec()); |
| 117 } | 117 } |
| 118 | 118 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (rv > 0) { | 154 if (rv > 0) { |
| 155 content.append(buf->data(), rv); | 155 content.append(buf->data(), rv); |
| 156 } else if (rv < 0) { | 156 } else if (rv < 0) { |
| 157 return rv; | 157 return rv; |
| 158 } | 158 } |
| 159 } while (rv > 0); | 159 } while (rv > 0); |
| 160 | 160 |
| 161 result->swap(content); | 161 result->swap(content); |
| 162 return net::OK; | 162 return net::OK; |
| 163 } | 163 } |
| OLD | NEW |