| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char kMockHeaders[] = | 26 const char kMockHeaders[] = |
| 27 "HTTP/1.0 200 OK\0Content-Length: 5\0\0"; | 27 "HTTP/1.0 200 OK\0Content-Length: 5\0\0"; |
| 28 const char kMockBody[] = "Hello"; | 28 const char kMockBody[] = "Hello"; |
| 29 const int kMockBodySize = 5; | 29 const int kMockBodySize = 5; |
| 30 | 30 |
| 31 class MockResponseReader : public AppCacheResponseReader { | 31 class MockResponseReader : public AppCacheResponseReader { |
| 32 public: | 32 public: |
| 33 MockResponseReader(int64 response_id, | 33 MockResponseReader(int64 response_id, |
| 34 net::HttpResponseInfo* info, int info_size, | 34 net::HttpResponseInfo* info, int info_size, |
| 35 const char* data, int data_size) | 35 const char* data, int data_size) |
| 36 : AppCacheResponseReader(response_id, NULL), | 36 : AppCacheResponseReader(response_id, 0, NULL), |
| 37 info_(info), info_size_(info_size), | 37 info_(info), info_size_(info_size), |
| 38 data_(data), data_size_(data_size) { | 38 data_(data), data_size_(data_size) { |
| 39 } | 39 } |
| 40 virtual void ReadInfo(HttpResponseInfoIOBuffer* info_buf, | 40 virtual void ReadInfo(HttpResponseInfoIOBuffer* info_buf, |
| 41 net::OldCompletionCallback* callback) OVERRIDE { | 41 net::OldCompletionCallback* callback) OVERRIDE { |
| 42 info_buffer_ = info_buf; | 42 info_buffer_ = info_buf; |
| 43 user_callback_ = callback; // Cleared on completion. | 43 user_callback_ = callback; // Cleared on completion. |
| 44 | 44 |
| 45 int rv = info_.get() ? info_size_ : net::ERR_FAILED; | 45 int rv = info_.get() ? info_size_ : net::ERR_FAILED; |
| 46 info_buffer_->http_info.reset(info_.release()); | 46 info_buffer_->http_info.reset(info_.release()); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 MessageLoop::current()->RunAllPending(); | 304 MessageLoop::current()->RunAllPending(); |
| 305 EXPECT_EQ(0, CountPendingHelpers()); | 305 EXPECT_EQ(0, CountPendingHelpers()); |
| 306 EXPECT_FALSE(IsGroupStored(kManifestUrl)); | 306 EXPECT_FALSE(IsGroupStored(kManifestUrl)); |
| 307 ResetStorage(); | 307 ResetStorage(); |
| 308 | 308 |
| 309 service_.reset(); // Clean up. | 309 service_.reset(); // Clean up. |
| 310 MessageLoop::current()->RunAllPending(); | 310 MessageLoop::current()->RunAllPending(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 } // namespace appcache | 313 } // namespace appcache |
| OLD | NEW |