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

Side by Side Diff: chrome/browser/chromeos/drive/drive_url_request_job_unittest.cc

Issue 13401003: chromeos: Replace resource ID in drive URL with path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded include Created 7 years, 8 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 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 "chrome/browser/chromeos/drive/drive_file_system_util.h"
9 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
10 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
11 #include "net/url_request/url_request_test_util.h" 12 #include "net/url_request/url_request_test_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace drive { 15 namespace drive {
15 16
16 class DriveFileSystem; 17 class DriveFileSystem;
17 18
18 namespace { 19 namespace {
(...skipping 19 matching lines...) Expand all
38 MessageLoopForIO message_loop_; 39 MessageLoopForIO message_loop_;
39 content::TestBrowserThread io_thread_; 40 content::TestBrowserThread io_thread_;
40 41
41 scoped_ptr<net::TestURLRequestContext> url_request_context_; 42 scoped_ptr<net::TestURLRequestContext> url_request_context_;
42 scoped_ptr<net::TestDelegate> delegate_; 43 scoped_ptr<net::TestDelegate> delegate_;
43 scoped_ptr<net::TestNetworkDelegate> network_delegate_; 44 scoped_ptr<net::TestNetworkDelegate> network_delegate_;
44 }; 45 };
45 46
46 TEST_F(DriveURLRequestJobTest, NonGetMethod) { 47 TEST_F(DriveURLRequestJobTest, NonGetMethod) {
47 net::TestURLRequest request( 48 net::TestURLRequest request(
48 GURL("drive:file_id"), delegate_.get(), url_request_context_.get()); 49 util::FilePathToDriveURL(base::FilePath::FromUTF8Unsafe("file")),
50 delegate_.get(), url_request_context_.get());
49 request.set_method("POST"); // Set non "GET" method. 51 request.set_method("POST"); // Set non "GET" method.
50 52
51 scoped_refptr<DriveURLRequestJob> job( 53 scoped_refptr<DriveURLRequestJob> job(
52 new DriveURLRequestJob( 54 new DriveURLRequestJob(
53 base::Bind(&GetNullDriveFileSystem), 55 base::Bind(&GetNullDriveFileSystem),
54 &request, network_delegate_.get())); 56 &request, network_delegate_.get()));
55 job->Start(); 57 job->Start();
56 MessageLoop::current()->RunUntilIdle(); 58 MessageLoop::current()->RunUntilIdle();
57 59
58 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); 60 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
59 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request.status().error()); 61 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request.status().error());
60 } 62 }
61 63
62 TEST_F(DriveURLRequestJobTest, NonDriveScheme) {
63 net::TestURLRequest request(
64 GURL("http://www.google.com"),
65 delegate_.get(), url_request_context_.get());
66
67 scoped_refptr<DriveURLRequestJob> job(
68 new DriveURLRequestJob(
69 base::Bind(&GetNullDriveFileSystem),
70 &request, network_delegate_.get()));
71 job->Start();
72 MessageLoop::current()->RunUntilIdle();
73
74 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
75 EXPECT_EQ(net::ERR_INVALID_URL, request.status().error());
76 }
77
78 } // namespace drive 64 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_url_request_job.cc ('k') | chrome/browser/chromeos/extensions/file_manager_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698