OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/google_apis/base_requests.h" | 5 #include "chrome/browser/google_apis/base_requests.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 request_sender_->auth_service()->set_access_token_for_testing( | 52 request_sender_->auth_service()->set_access_token_for_testing( |
53 kTestAuthToken); | 53 kTestAuthToken); |
54 | 54 |
55 ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); | 55 ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); |
56 test_server_.RegisterRequestHandler( | 56 test_server_.RegisterRequestHandler( |
57 base::Bind(&test_util::HandleDownloadFileRequest, | 57 base::Bind(&test_util::HandleDownloadFileRequest, |
58 test_server_.base_url(), | 58 test_server_.base_url(), |
59 base::Unretained(&http_request_))); | 59 base::Unretained(&http_request_))); |
60 } | 60 } |
61 | 61 |
62 virtual void TearDown() OVERRIDE { | |
63 EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); | |
64 request_context_getter_ = NULL; | |
65 } | |
66 | |
67 // Returns a temporary file path suitable for storing the cache file. | 62 // Returns a temporary file path suitable for storing the cache file. |
68 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { | 63 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { |
69 return profile_->GetPath().Append(file_name); | 64 return profile_->GetPath().Append(file_name); |
70 } | 65 } |
71 | 66 |
72 content::TestBrowserThreadBundle thread_bundle_; | 67 content::TestBrowserThreadBundle thread_bundle_; |
73 net::test_server::EmbeddedTestServer test_server_; | 68 net::test_server::EmbeddedTestServer test_server_; |
74 scoped_ptr<TestingProfile> profile_; | 69 scoped_ptr<TestingProfile> profile_; |
75 scoped_ptr<RequestSender> request_sender_; | 70 scoped_ptr<RequestSender> request_sender_; |
76 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 71 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 run_loop.Run(); | 129 run_loop.Run(); |
135 } | 130 } |
136 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 131 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
137 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 132 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
138 EXPECT_EQ("/files/gdata/no-such-file.txt", | 133 EXPECT_EQ("/files/gdata/no-such-file.txt", |
139 http_request_.relative_url); | 134 http_request_.relative_url); |
140 // Do not verify the not found message. | 135 // Do not verify the not found message. |
141 } | 136 } |
142 | 137 |
143 } // namespace google_apis | 138 } // namespace google_apis |
OLD | NEW |