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/bind.h" | |
7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
8 #include "base/pickle.h" | 9 #include "base/pickle.h" |
9 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
10 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
11 #include "net/http/http_response_headers.h" | 12 #include "net/http/http_response_headers.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webkit/appcache/appcache_response.h" | 14 #include "webkit/appcache/appcache_response.h" |
14 #include "webkit/appcache/appcache_service.h" | 15 #include "webkit/appcache/appcache_service.h" |
15 #include "webkit/appcache/mock_appcache_storage.h" | 16 #include "webkit/appcache/mock_appcache_storage.h" |
16 | 17 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 } | 60 } |
60 DCHECK(buf_len >= data_size_); | 61 DCHECK(buf_len >= data_size_); |
61 memcpy(buf->data(), data_, data_size_); | 62 memcpy(buf->data(), data_, data_size_); |
62 ScheduleUserCallback(data_size_); | 63 ScheduleUserCallback(data_size_); |
63 data_size_ = 0; | 64 data_size_ = 0; |
64 } | 65 } |
65 | 66 |
66 private: | 67 private: |
67 void ScheduleUserCallback(int result) { | 68 void ScheduleUserCallback(int result) { |
68 MessageLoop::current()->PostTask(FROM_HERE, | 69 MessageLoop::current()->PostTask(FROM_HERE, |
69 method_factory_.NewRunnableMethod( | 70 base::Bind(&MockResponseReader::InvokeUserOldCompletionCallback, |
70 &MockResponseReader::InvokeUserOldCompletionCallback, result)); | 71 weak_factory_.GetWeakPtr(), result)); |
James Hawkins
2011/10/27 03:30:32
Nit: For both function calls, line up parameters o
michaeln
2011/10/27 19:20:02
Done.
| |
71 } | 72 } |
72 | 73 |
73 scoped_ptr<net::HttpResponseInfo> info_; | 74 scoped_ptr<net::HttpResponseInfo> info_; |
74 int info_size_; | 75 int info_size_; |
75 const char* data_; | 76 const char* data_; |
76 int data_size_; | 77 int data_size_; |
77 }; | 78 }; |
78 | 79 |
79 } // namespace | 80 } // namespace |
80 | 81 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 MessageLoop::current()->RunAllPending(); | 305 MessageLoop::current()->RunAllPending(); |
305 EXPECT_EQ(0, CountPendingHelpers()); | 306 EXPECT_EQ(0, CountPendingHelpers()); |
306 EXPECT_FALSE(IsGroupStored(kManifestUrl)); | 307 EXPECT_FALSE(IsGroupStored(kManifestUrl)); |
307 ResetStorage(); | 308 ResetStorage(); |
308 | 309 |
309 service_.reset(); // Clean up. | 310 service_.reset(); // Clean up. |
310 MessageLoop::current()->RunAllPending(); | 311 MessageLoop::current()->RunAllPending(); |
311 } | 312 } |
312 | 313 |
313 } // namespace appcache | 314 } // namespace appcache |
OLD | NEW |