Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/drive_url_request_job.h" | 5 #include "chrome/browser/chromeos/drive/drive_url_request_job.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 "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 MessageLoopForIO message_loop_; | 38 MessageLoopForIO message_loop_; |
| 39 content::TestBrowserThread io_thread_; | 39 content::TestBrowserThread io_thread_; |
| 40 | 40 |
| 41 scoped_ptr<net::TestURLRequestContext> url_request_context_; | 41 scoped_ptr<net::TestURLRequestContext> url_request_context_; |
| 42 scoped_ptr<net::TestDelegate> delegate_; | 42 scoped_ptr<net::TestDelegate> delegate_; |
| 43 scoped_ptr<net::TestNetworkDelegate> network_delegate_; | 43 scoped_ptr<net::TestNetworkDelegate> network_delegate_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 TEST_F(DriveURLRequestJobTest, NonGetMethod) { | 46 TEST_F(DriveURLRequestJobTest, NonGetMethod) { |
| 47 net::TestURLRequest request( | 47 net::TestURLRequest request( |
| 48 GURL("drive:file_id"), delegate_.get(), url_request_context_.get()); | 48 GURL("drive:file_id"), |
| 49 delegate_.get(), url_request_context_.get(), network_delegate_.get()); | |
|
hshi1
2013/03/26 03:50:14
If they do not fit one line, then it is recommende
| |
| 49 request.set_method("POST"); // Set non "GET" method. | 50 request.set_method("POST"); // Set non "GET" method. |
| 50 | 51 |
| 51 scoped_refptr<DriveURLRequestJob> job( | 52 scoped_refptr<DriveURLRequestJob> job( |
| 52 new DriveURLRequestJob( | 53 new DriveURLRequestJob( |
| 53 base::Bind(&GetNullDriveFileSystem), | 54 base::Bind(&GetNullDriveFileSystem), |
| 54 &request, network_delegate_.get())); | 55 &request, network_delegate_.get())); |
| 55 job->Start(); | 56 job->Start(); |
| 56 MessageLoop::current()->RunUntilIdle(); | 57 MessageLoop::current()->RunUntilIdle(); |
| 57 | 58 |
| 58 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); | 59 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); |
| 59 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request.status().error()); | 60 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request.status().error()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 TEST_F(DriveURLRequestJobTest, NonDriveScheme) { | 63 TEST_F(DriveURLRequestJobTest, NonDriveScheme) { |
| 63 net::TestURLRequest request( | 64 net::TestURLRequest request( |
| 64 GURL("http://www.google.com"), | 65 GURL("http://www.google.com"), |
| 65 delegate_.get(), url_request_context_.get()); | 66 delegate_.get(), url_request_context_.get(), network_delegate_.get()); |
|
hshi1
2013/03/26 03:50:14
Same as above.
| |
| 66 | 67 |
| 67 scoped_refptr<DriveURLRequestJob> job( | 68 scoped_refptr<DriveURLRequestJob> job( |
| 68 new DriveURLRequestJob( | 69 new DriveURLRequestJob( |
| 69 base::Bind(&GetNullDriveFileSystem), | 70 base::Bind(&GetNullDriveFileSystem), |
| 70 &request, network_delegate_.get())); | 71 &request, network_delegate_.get())); |
| 71 job->Start(); | 72 job->Start(); |
| 72 MessageLoop::current()->RunUntilIdle(); | 73 MessageLoop::current()->RunUntilIdle(); |
| 73 | 74 |
| 74 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); | 75 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); |
| 75 EXPECT_EQ(net::ERR_INVALID_URL, request.status().error()); | 76 EXPECT_EQ(net::ERR_INVALID_URL, request.status().error()); |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace drive | 79 } // namespace drive |
| OLD | NEW |