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

Side by Side Diff: net/url_request/url_request_job_factory_impl_unittest.cc

Issue 1003953008: Remove prerender cookie store, part 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prerender-revert-cookie-store-3
Patch Set: rebase (just in case since this is so huge) Created 5 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
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | net/url_request/url_request_job_unittest.cc » ('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) 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 "net/url_request/url_request_job_factory_impl.h" 5 #include "net/url_request/url_request_job_factory_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "net/base/request_priority.h" 10 #include "net/base/request_priority.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 request, 56 request,
57 network_delegate, 57 network_delegate,
58 URLRequestStatus(URLRequestStatus::SUCCESS, OK)); 58 URLRequestStatus(URLRequestStatus::SUCCESS, OK));
59 } 59 }
60 }; 60 };
61 61
62 TEST(URLRequestJobFactoryTest, NoProtocolHandler) { 62 TEST(URLRequestJobFactoryTest, NoProtocolHandler) {
63 TestDelegate delegate; 63 TestDelegate delegate;
64 TestURLRequestContext request_context; 64 TestURLRequestContext request_context;
65 scoped_ptr<URLRequest> request(request_context.CreateRequest( 65 scoped_ptr<URLRequest> request(request_context.CreateRequest(
66 GURL("foo://bar"), DEFAULT_PRIORITY, &delegate, NULL)); 66 GURL("foo://bar"), DEFAULT_PRIORITY, &delegate));
67 request->Start(); 67 request->Start();
68 68
69 base::MessageLoop::current()->Run(); 69 base::MessageLoop::current()->Run();
70 EXPECT_EQ(URLRequestStatus::FAILED, request->status().status()); 70 EXPECT_EQ(URLRequestStatus::FAILED, request->status().status());
71 EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request->status().error()); 71 EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request->status().error());
72 } 72 }
73 73
74 TEST(URLRequestJobFactoryTest, BasicProtocolHandler) { 74 TEST(URLRequestJobFactoryTest, BasicProtocolHandler) {
75 TestDelegate delegate; 75 TestDelegate delegate;
76 URLRequestJobFactoryImpl job_factory; 76 URLRequestJobFactoryImpl job_factory;
77 TestURLRequestContext request_context; 77 TestURLRequestContext request_context;
78 request_context.set_job_factory(&job_factory); 78 request_context.set_job_factory(&job_factory);
79 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); 79 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
80 scoped_ptr<URLRequest> request(request_context.CreateRequest( 80 scoped_ptr<URLRequest> request(request_context.CreateRequest(
81 GURL("foo://bar"), DEFAULT_PRIORITY, &delegate, NULL)); 81 GURL("foo://bar"), DEFAULT_PRIORITY, &delegate));
82 request->Start(); 82 request->Start();
83 83
84 base::MessageLoop::current()->Run(); 84 base::MessageLoop::current()->Run();
85 EXPECT_EQ(URLRequestStatus::SUCCESS, request->status().status()); 85 EXPECT_EQ(URLRequestStatus::SUCCESS, request->status().status());
86 EXPECT_EQ(OK, request->status().error()); 86 EXPECT_EQ(OK, request->status().error());
87 } 87 }
88 88
89 TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) { 89 TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) {
90 URLRequestJobFactoryImpl job_factory; 90 URLRequestJobFactoryImpl job_factory;
91 TestURLRequestContext request_context; 91 TestURLRequestContext request_context;
92 request_context.set_job_factory(&job_factory); 92 request_context.set_job_factory(&job_factory);
93 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler); 93 job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
94 job_factory.SetProtocolHandler("foo", NULL); 94 job_factory.SetProtocolHandler("foo", NULL);
95 } 95 }
96 96
97 } // namespace 97 } // namespace
98 98
99 } // namespace net 99 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | net/url_request/url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698