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

Side by Side Diff: chrome/browser/sync/glue/http_bridge_unittest.cc

Issue 9022034: Convert various ReleaseSoon methods to use base::Bind() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 11 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 | « base/task.h ('k') | content/public/browser/browser_thread.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) 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 "base/message_loop_proxy.h" 5 #include "base/message_loop_proxy.h"
6 #include "base/threading/thread.h" 6 #include "base/threading/thread.h"
7 #include "chrome/browser/sync/glue/http_bridge.h" 7 #include "chrome/browser/sync/glue/http_bridge.h"
8 #include "chrome/test/base/test_url_request_context_getter.h" 8 #include "chrome/test/base/test_url_request_context_getter.h"
9 #include "content/test/test_browser_thread.h" 9 #include "content/test/test_browser_thread.h"
10 #include "content/test/test_url_fetcher_factory.h" 10 #include "content/test/test_url_fetcher_factory.h"
(...skipping 15 matching lines...) Expand all
26 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)), 26 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)),
27 fake_default_request_context_getter_(NULL), 27 fake_default_request_context_getter_(NULL),
28 io_thread_(BrowserThread::IO) { 28 io_thread_(BrowserThread::IO) {
29 } 29 }
30 30
31 virtual void SetUp() { 31 virtual void SetUp() {
32 io_thread_.StartIOThread(); 32 io_thread_.StartIOThread();
33 } 33 }
34 34
35 virtual void TearDown() { 35 virtual void TearDown() {
36 GetIOThreadLoop()->ReleaseSoon(FROM_HERE, 36 if (fake_default_request_context_getter_) {
37 fake_default_request_context_getter_); 37 GetIOThreadLoop()->ReleaseSoon(FROM_HERE,
38 fake_default_request_context_getter_);
39 fake_default_request_context_getter_ = NULL;
40 }
38 io_thread_.Stop(); 41 io_thread_.Stop();
39 fake_default_request_context_getter_ = NULL;
40 } 42 }
41 43
42 HttpBridge* BuildBridge() { 44 HttpBridge* BuildBridge() {
43 if (!fake_default_request_context_getter_) { 45 if (!fake_default_request_context_getter_) {
44 fake_default_request_context_getter_ = new TestURLRequestContextGetter(); 46 fake_default_request_context_getter_ = new TestURLRequestContextGetter();
45 fake_default_request_context_getter_->AddRef(); 47 fake_default_request_context_getter_->AddRef();
46 } 48 }
47 HttpBridge* bridge = new HttpBridge( 49 HttpBridge* bridge = new HttpBridge(
48 new HttpBridge::RequestContextGetter( 50 new HttpBridge::RequestContextGetter(
49 fake_default_request_context_getter_)); 51 fake_default_request_context_getter_));
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 http_bridge->SetPostPayload("text/plain", 2, " "); 297 http_bridge->SetPostPayload("text/plain", 2, " ");
296 298
297 int os_error = 0; 299 int os_error = 0;
298 int response_code = 0; 300 int response_code = 0;
299 301
300 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); 302 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code);
301 ASSERT_TRUE(success); 303 ASSERT_TRUE(success);
302 http_bridge->Abort(); 304 http_bridge->Abort();
303 // Ensures no double-free of URLFetcher, etc. 305 // Ensures no double-free of URLFetcher, etc.
304 } 306 }
OLDNEW
« no previous file with comments | « base/task.h ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698