| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/test/test_simple_task_runner.h" | 6 #include "base/test/test_simple_task_runner.h" |
| 7 #include "components/drive/service/drive_api_service.h" | 7 #include "components/drive/service/drive_api_service.h" |
| 8 #include "google_apis/drive/dummy_auth_service.h" | 8 #include "google_apis/drive/dummy_auth_service.h" |
| 9 #include "google_apis/drive/request_sender.h" | 9 #include "google_apis/drive/request_sender.h" |
| 10 #include "google_apis/drive/test_util.h" | 10 #include "google_apis/drive/test_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 ASSERT_FALSE(callback_.is_null()); | 29 ASSERT_FALSE(callback_.is_null()); |
| 30 callback_.Run(google_apis::HTTP_UNAUTHORIZED, ""); | 30 callback_.Run(google_apis::HTTP_UNAUTHORIZED, ""); |
| 31 } | 31 } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 google_apis::AuthStatusCallback callback_; | 34 google_apis::AuthStatusCallback callback_; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 TEST(DriveAPIServiceTest, BatchRequestConfiguratorWithAuthFailure) { | 37 TEST(DriveAPIServiceTest, BatchRequestConfiguratorWithAuthFailure) { |
| 38 const GURL test_base_url("http://localhost/"); | 38 const GURL test_base_url("http://localhost/"); |
| 39 google_apis::DriveApiUrlGenerator url_generator( | 39 google_apis::DriveApiUrlGenerator url_generator(test_base_url, test_base_url); |
| 40 test_base_url, test_base_url, test_base_url); | |
| 41 scoped_refptr<base::TestSimpleTaskRunner> task_runner = | 40 scoped_refptr<base::TestSimpleTaskRunner> task_runner = |
| 42 new base::TestSimpleTaskRunner(); | 41 new base::TestSimpleTaskRunner(); |
| 43 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = | 42 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = |
| 44 new net::TestURLRequestContextGetter(task_runner.get()); | 43 new net::TestURLRequestContextGetter(task_runner.get()); |
| 45 google_apis::RequestSender sender(new TestAuthService, | 44 google_apis::RequestSender sender(new TestAuthService, |
| 46 request_context_getter.get(), | 45 request_context_getter.get(), |
| 47 task_runner.get(), kTestUserAgent); | 46 task_runner.get(), kTestUserAgent); |
| 48 google_apis::drive::BatchUploadRequest* const request = | 47 google_apis::drive::BatchUploadRequest* const request = |
| 49 new google_apis::drive::BatchUploadRequest(&sender, url_generator); | 48 new google_apis::drive::BatchUploadRequest(&sender, url_generator); |
| 50 sender.StartRequestWithAuthRetry(request); | 49 sender.StartRequestWithAuthRetry(request); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 "text/plain", 10, "resource_id", | 70 "text/plain", 10, "resource_id", |
| 72 base::FilePath(FILE_PATH_LITERAL("/file")), UploadExistingFileOptions(), | 71 base::FilePath(FILE_PATH_LITERAL("/file")), UploadExistingFileOptions(), |
| 73 google_apis::test_util::CreateCopyResultCallback(&error, | 72 google_apis::test_util::CreateCopyResultCallback(&error, |
| 74 &file_resource), | 73 &file_resource), |
| 75 google_apis::ProgressCallback()); | 74 google_apis::ProgressCallback()); |
| 76 EXPECT_EQ(google_apis::DRIVE_OTHER_ERROR, error); | 75 EXPECT_EQ(google_apis::DRIVE_OTHER_ERROR, error); |
| 77 } | 76 } |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace drive | 79 } // namespace drive |
| OLD | NEW |