OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 request_context_getter_.get(), | 61 request_context_getter_.get(), |
62 std::vector<std::string>(), | 62 std::vector<std::string>(), |
63 kTestUserAgent)); | 63 kTestUserAgent)); |
64 operation_runner_->auth_service()->set_access_token_for_testing( | 64 operation_runner_->auth_service()->set_access_token_for_testing( |
65 kTestGDataAuthToken); | 65 kTestGDataAuthToken); |
66 | 66 |
67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
68 | 68 |
69 ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); | 69 ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); |
70 test_server_.RegisterRequestHandler( | 70 test_server_.RegisterRequestHandler( |
71 base::Bind(&test_util::HandleDownloadRequest, | 71 base::Bind(&test_util::HandleDownloadFileRequest, |
72 test_server_.base_url(), | 72 test_server_.base_url(), |
73 base::Unretained(&http_request_))); | 73 base::Unretained(&http_request_))); |
74 test_server_.RegisterRequestHandler( | 74 test_server_.RegisterRequestHandler( |
75 base::Bind(&GDataWapiOperationsTest::HandleResourceFeedRequest, | 75 base::Bind(&GDataWapiOperationsTest::HandleResourceFeedRequest, |
76 base::Unretained(this))); | 76 base::Unretained(this))); |
77 test_server_.RegisterRequestHandler( | 77 test_server_.RegisterRequestHandler( |
78 base::Bind(&GDataWapiOperationsTest::HandleMetadataRequest, | 78 base::Bind(&GDataWapiOperationsTest::HandleMetadataRequest, |
79 base::Unretained(this))); | 79 base::Unretained(this))); |
80 test_server_.RegisterRequestHandler( | 80 test_server_.RegisterRequestHandler( |
81 base::Bind(&GDataWapiOperationsTest::HandleCreateSessionRequest, | 81 base::Bind(&GDataWapiOperationsTest::HandleCreateSessionRequest, |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 EXPECT_EQ("<?xml version=\"1.0\"?>\n" | 1050 EXPECT_EQ("<?xml version=\"1.0\"?>\n" |
1051 "<entry xmlns=\"http://www.w3.org/2005/Atom\" " | 1051 "<entry xmlns=\"http://www.w3.org/2005/Atom\" " |
1052 "xmlns:docs=\"http://schemas.google.com/docs/2007\">\n" | 1052 "xmlns:docs=\"http://schemas.google.com/docs/2007\">\n" |
1053 " <title>New file</title>\n" | 1053 " <title>New file</title>\n" |
1054 "</entry>\n", | 1054 "</entry>\n", |
1055 http_request_.content); | 1055 http_request_.content); |
1056 | 1056 |
1057 #if !defined(NO_GET_UPLOAD_STATUS_TEST) | 1057 #if !defined(NO_GET_UPLOAD_STATUS_TEST) |
1058 // 2) Before sending any data, check the current status. | 1058 // 2) Before sending any data, check the current status. |
1059 // This is an edge case test for GetUploadStatusOperation | 1059 // This is an edge case test for GetUploadStatusOperation |
1060 // (UploadRangeOperationBase). | 1060 // (UploadRangeRequestBase). |
1061 { | 1061 { |
1062 UploadRangeResponse response; | 1062 UploadRangeResponse response; |
1063 scoped_ptr<ResourceEntry> new_entry; | 1063 scoped_ptr<ResourceEntry> new_entry; |
1064 | 1064 |
1065 // Check the response by GetUploadStatusOperation. | 1065 // Check the response by GetUploadStatusOperation. |
1066 GetUploadStatusOperation* get_upload_status_operation = | 1066 GetUploadStatusOperation* get_upload_status_operation = |
1067 new GetUploadStatusOperation( | 1067 new GetUploadStatusOperation( |
1068 operation_runner_.get(), | 1068 operation_runner_.get(), |
1069 request_context_getter_.get(), | 1069 request_context_getter_.get(), |
1070 CreateComposedCallback( | 1070 CreateComposedCallback( |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 EXPECT_EQ(base::Int64ToString(kUploadContent.size()), | 1508 EXPECT_EQ(base::Int64ToString(kUploadContent.size()), |
1509 http_request_.headers["X-Upload-Content-Length"]); | 1509 http_request_.headers["X-Upload-Content-Length"]); |
1510 // For updating an existing file, an empty body should be attached (PUT | 1510 // For updating an existing file, an empty body should be attached (PUT |
1511 // requires a body) | 1511 // requires a body) |
1512 EXPECT_TRUE(http_request_.has_content); | 1512 EXPECT_TRUE(http_request_.has_content); |
1513 EXPECT_EQ("", http_request_.content); | 1513 EXPECT_EQ("", http_request_.content); |
1514 EXPECT_EQ(kWrongETag, http_request_.headers["If-Match"]); | 1514 EXPECT_EQ(kWrongETag, http_request_.headers["If-Match"]); |
1515 } | 1515 } |
1516 | 1516 |
1517 } // namespace google_apis | 1517 } // namespace google_apis |
OLD | NEW |