| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/google_apis/drive_api_operations.h" | 10 #include "chrome/browser/google_apis/drive_api_operations.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 const char kTestUploadExistingFilePath[] = "/upload/existingfile/path"; | 39 const char kTestUploadExistingFilePath[] = "/upload/existingfile/path"; |
| 40 const char kTestUploadNewFilePath[] = "/upload/newfile/path"; | 40 const char kTestUploadNewFilePath[] = "/upload/newfile/path"; |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 class DriveApiOperationsTest : public testing::Test { | 44 class DriveApiOperationsTest : public testing::Test { |
| 45 public: | 45 public: |
| 46 DriveApiOperationsTest() | 46 DriveApiOperationsTest() |
| 47 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 47 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 48 file_thread_(content::BrowserThread::FILE), | 48 file_thread_(content::BrowserThread::FILE), |
| 49 io_thread_(content::BrowserThread::IO) { | 49 io_thread_(content::BrowserThread::IO), |
| 50 test_server_(content::BrowserThread::GetMessageLoopProxyForThread( |
| 51 content::BrowserThread::IO)) { |
| 50 } | 52 } |
| 51 | 53 |
| 52 virtual void SetUp() OVERRIDE { | 54 virtual void SetUp() OVERRIDE { |
| 53 file_thread_.Start(); | 55 file_thread_.Start(); |
| 54 io_thread_.StartIOThread(); | 56 io_thread_.StartIOThread(); |
| 55 | 57 |
| 56 request_context_getter_ = new net::TestURLRequestContextGetter( | 58 request_context_getter_ = new net::TestURLRequestContextGetter( |
| 57 content::BrowserThread::GetMessageLoopProxyForThread( | 59 content::BrowserThread::GetMessageLoopProxyForThread( |
| 58 content::BrowserThread::IO)); | 60 content::BrowserThread::IO)); |
| 59 | 61 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 url_generator_.reset(new DriveApiUrlGenerator( | 79 url_generator_.reset(new DriveApiUrlGenerator( |
| 78 test_util::GetBaseUrlForTesting(test_server_.port()))); | 80 test_util::GetBaseUrlForTesting(test_server_.port()))); |
| 79 | 81 |
| 80 // Reset the server's expected behavior just in case. | 82 // Reset the server's expected behavior just in case. |
| 81 ResetExpectedResponse(); | 83 ResetExpectedResponse(); |
| 82 received_bytes_ = 0; | 84 received_bytes_ = 0; |
| 83 content_length_ = 0; | 85 content_length_ = 0; |
| 84 } | 86 } |
| 85 | 87 |
| 86 virtual void TearDown() OVERRIDE { | 88 virtual void TearDown() OVERRIDE { |
| 87 test_server_.ShutdownAndWaitUntilComplete(); | 89 EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); |
| 88 request_context_getter_ = NULL; | 90 request_context_getter_ = NULL; |
| 89 ResetExpectedResponse(); | 91 ResetExpectedResponse(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 MessageLoopForUI message_loop_; | 94 MessageLoopForUI message_loop_; |
| 93 content::TestBrowserThread ui_thread_; | 95 content::TestBrowserThread ui_thread_; |
| 94 content::TestBrowserThread file_thread_; | 96 content::TestBrowserThread file_thread_; |
| 95 content::TestBrowserThread io_thread_; | 97 content::TestBrowserThread io_thread_; |
| 96 test_server::HttpServer test_server_; | 98 test_server::HttpServer test_server_; |
| 97 OperationRegistry operation_registry_; | 99 OperationRegistry operation_registry_; |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 EXPECT_EQ("Conflicting-etag", http_request_.headers["If-Match"]); | 1171 EXPECT_EQ("Conflicting-etag", http_request_.headers["If-Match"]); |
| 1170 | 1172 |
| 1171 EXPECT_EQ(test_server::METHOD_PUT, http_request_.method); | 1173 EXPECT_EQ(test_server::METHOD_PUT, http_request_.method); |
| 1172 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable", | 1174 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable", |
| 1173 http_request_.relative_url); | 1175 http_request_.relative_url); |
| 1174 EXPECT_TRUE(http_request_.has_content); | 1176 EXPECT_TRUE(http_request_.has_content); |
| 1175 EXPECT_TRUE(http_request_.content.empty()); | 1177 EXPECT_TRUE(http_request_.content.empty()); |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 } // namespace google_apis | 1180 } // namespace google_apis |
| OLD | NEW |