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

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

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address erikwright's comments Created 7 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
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/ftp/ftp_auth_cache.h"
6 #include "net/ftp/ftp_transaction.h" 5 #include "net/ftp/ftp_transaction.h"
7 #include "net/ftp/ftp_transaction_factory.h" 6 #include "net/ftp/ftp_transaction_factory.h"
8 #include "net/url_request/ftp_protocol_handler.h" 7 #include "net/url_request/ftp_protocol_handler.h"
9 #include "net/url_request/url_request.h" 8 #include "net/url_request/url_request.h"
10 #include "net/url_request/url_request_context.h" 9 #include "net/url_request/url_request_context.h"
11 #include "net/url_request/url_request_ftp_job.h" 10 #include "net/url_request/url_request_ftp_job.h"
12 #include "net/url_request/url_request_status.h" 11 #include "net/url_request/url_request_status.h"
13 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
(...skipping 27 matching lines...) Expand all
43 42
44 ACTION_P(HandleOnResponseStarted, expected_status) { 43 ACTION_P(HandleOnResponseStarted, expected_status) {
45 EXPECT_EQ(expected_status, arg0->status().status()); 44 EXPECT_EQ(expected_status, arg0->status().status());
46 } 45 }
47 46
48 TEST(FtpProtocolHandlerTest, CreateTransactionFails) { 47 TEST(FtpProtocolHandlerTest, CreateTransactionFails) {
49 testing::InSequence in_sequence_; 48 testing::InSequence in_sequence_;
50 49
51 ::testing::StrictMock<MockFtpTransactionFactory> ftp_transaction_factory; 50 ::testing::StrictMock<MockFtpTransactionFactory> ftp_transaction_factory;
52 ::testing::StrictMock<MockURLRequestDelegate> delegate; 51 ::testing::StrictMock<MockURLRequestDelegate> delegate;
53 FtpAuthCache ftp_auth_cache;
54 52
55 GURL url("ftp://example.com"); 53 GURL url("ftp://example.com");
56 URLRequestContext context; 54 URLRequestContext context;
57 URLRequest url_request(url, &delegate, &context); 55 URLRequest url_request(url, &delegate, &context);
58 56
59 FtpProtocolHandler ftp_protocol_handler( 57 FtpProtocolHandler ftp_protocol_handler(&ftp_transaction_factory);
60 &ftp_transaction_factory, &ftp_auth_cache);
61 58
62 scoped_refptr<URLRequestJob> ftp_job( 59 scoped_refptr<URLRequestJob> ftp_job(
63 ftp_protocol_handler.MaybeCreateJob(&url_request, NULL)); 60 ftp_protocol_handler.MaybeCreateJob(&url_request, NULL));
64 ASSERT_TRUE(ftp_job.get()); 61 ASSERT_TRUE(ftp_job.get());
65 62
66 EXPECT_CALL(ftp_transaction_factory, CreateTransaction()) 63 EXPECT_CALL(ftp_transaction_factory, CreateTransaction())
67 .WillOnce(Return(static_cast<FtpTransaction*>(NULL))); 64 .WillOnce(Return(static_cast<FtpTransaction*>(NULL)));
68 ftp_job->Start(); 65 ftp_job->Start();
69 EXPECT_CALL(delegate, OnResponseStarted(_)) 66 EXPECT_CALL(delegate, OnResponseStarted(_))
70 .WillOnce(HandleOnResponseStarted(URLRequestStatus::FAILED)); 67 .WillOnce(HandleOnResponseStarted(URLRequestStatus::FAILED));
71 MessageLoop::current()->RunUntilIdle(); 68 MessageLoop::current()->RunUntilIdle();
72 EXPECT_FALSE(url_request.is_pending()); 69 EXPECT_FALSE(url_request.is_pending());
73 } 70 }
74 71
75 } // namespace net 72 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698