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

Side by Side Diff: content/browser/appcache/appcache_service_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h"
10 #include "base/pickle.h" 9 #include "base/pickle.h"
11 #include "base/run_loop.h" 10 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h"
14 #include "content/browser/appcache/appcache_response.h" 11 #include "content/browser/appcache/appcache_response.h"
15 #include "content/browser/appcache/appcache_service_impl.h" 12 #include "content/browser/appcache/appcache_service_impl.h"
16 #include "content/browser/appcache/mock_appcache_storage.h" 13 #include "content/browser/appcache/mock_appcache_storage.h"
17 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
18 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
19 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
20 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
21 18
22 namespace content { 19 namespace content {
23 namespace { 20 namespace {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return; 60 return;
64 } 61 }
65 DCHECK(buf_len >= data_size_); 62 DCHECK(buf_len >= data_size_);
66 memcpy(buf->data(), data_, data_size_); 63 memcpy(buf->data(), data_, data_size_);
67 ScheduleUserCallback(data_size_); 64 ScheduleUserCallback(data_size_);
68 data_size_ = 0; 65 data_size_ = 0;
69 } 66 }
70 67
71 private: 68 private:
72 void ScheduleUserCallback(int result) { 69 void ScheduleUserCallback(int result) {
73 base::ThreadTaskRunnerHandle::Get()->PostTask( 70 base::MessageLoop::current()->PostTask(FROM_HERE,
74 FROM_HERE, base::Bind(&MockResponseReader::InvokeUserCompletionCallback, 71 base::Bind(&MockResponseReader::InvokeUserCompletionCallback,
75 weak_factory_.GetWeakPtr(), result)); 72 weak_factory_.GetWeakPtr(), result));
76 } 73 }
77 74
78 scoped_ptr<net::HttpResponseInfo> info_; 75 scoped_ptr<net::HttpResponseInfo> info_;
79 int info_size_; 76 int info_size_;
80 const char* data_; 77 const char* data_;
81 int data_size_; 78 int data_size_;
82 }; 79 };
83 80
84 } // namespace 81 } // namespace
85 82
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay()); 369 EXPECT_EQ(kOneHour, service->reinit_timer_.GetCurrentDelay());
373 EXPECT_EQ(kOneHour, service->next_reinit_delay_); 370 EXPECT_EQ(kOneHour, service->next_reinit_delay_);
374 371
375 // Fine to delete while pending. 372 // Fine to delete while pending.
376 service.reset(NULL); 373 service.reset(NULL);
377 } 374 }
378 375
379 376
380 377
381 } // namespace content 378 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_service_impl.cc ('k') | content/browser/appcache/appcache_storage_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698