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

Side by Side Diff: content/common/net/url_fetcher_impl_unittest.cc

Issue 9562037: Move TestURLRequestContextGetter to url_request_test_util.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change comment Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/net/url_fetcher_impl.h" 5 #include "content/common/net/url_fetcher_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 14 matching lines...) Expand all
25 using base::Time; 25 using base::Time;
26 using base::TimeDelta; 26 using base::TimeDelta;
27 27
28 // TODO(eroman): Add a regression test for http://crbug.com/40505. 28 // TODO(eroman): Add a regression test for http://crbug.com/40505.
29 29
30 namespace { 30 namespace {
31 31
32 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); 32 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
33 const char kTestServerFilePrefix[] = "files/"; 33 const char kTestServerFilePrefix[] = "files/";
34 34
35 class TestURLRequestContextGetter : public net::URLRequestContextGetter {
36 public:
37 explicit TestURLRequestContextGetter(
38 base::MessageLoopProxy* io_message_loop_proxy)
39 : io_message_loop_proxy_(io_message_loop_proxy) {
40 }
41 virtual net::URLRequestContext* GetURLRequestContext() {
42 if (!context_)
43 context_ = new TestURLRequestContext();
44 return context_;
45 }
46 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
47 return io_message_loop_proxy_;
48 }
49
50 protected:
51 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
52
53 private:
54 virtual ~TestURLRequestContextGetter() {}
55
56 scoped_refptr<net::URLRequestContext> context_;
57 };
58
59 } // namespace 35 } // namespace
60 36
61 class URLFetcherTest : public testing::Test, 37 class URLFetcherTest : public testing::Test,
62 public content::URLFetcherDelegate { 38 public content::URLFetcherDelegate {
63 public: 39 public:
64 URLFetcherTest() : fetcher_(NULL) { } 40 URLFetcherTest() : fetcher_(NULL) { }
65 41
66 static int GetNumFetcherCores() { 42 static int GetNumFetcherCores() {
67 return URLFetcherImpl::GetNumFetcherCores(); 43 return URLFetcherImpl::GetNumFetcherCores();
68 } 44 }
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 io_message_loop_proxy()->PostTaskAndReply( 889 io_message_loop_proxy()->PostTaskAndReply(
914 FROM_HERE, 890 FROM_HERE,
915 base::Bind(&CancelAllOnIO), 891 base::Bind(&CancelAllOnIO),
916 MessageLoop::QuitClosure()); 892 MessageLoop::QuitClosure());
917 MessageLoop::current()->Run(); 893 MessageLoop::current()->Run();
918 EXPECT_EQ(0, GetNumFetcherCores()); 894 EXPECT_EQ(0, GetNumFetcherCores());
919 delete fetcher_; 895 delete fetcher_;
920 } 896 }
921 897
922 } // namespace. 898 } // namespace.
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | jingle/notifier/base/proxy_resolving_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698