| 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 "webkit/glue/resource_request_body.h" | 5 #include "webkit/glue/resource_request_body.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 GURL blob_url2("blob://url_2"); | 72 GURL blob_url2("blob://url_2"); |
| 73 blob_storage_controller.CloneBlob(blob_url2, blob_url1); | 73 blob_storage_controller.CloneBlob(blob_url2, blob_url1); |
| 74 | 74 |
| 75 GURL blob_url3("blob://url_3"); | 75 GURL blob_url3("blob://url_3"); |
| 76 blob_storage_controller.CloneBlob(blob_url3, blob_url2); | 76 blob_storage_controller.CloneBlob(blob_url3, blob_url2); |
| 77 | 77 |
| 78 // Setup upload data elements for comparison. | 78 // Setup upload data elements for comparison. |
| 79 net::UploadElement blob_element1, blob_element2; | 79 net::UploadElement blob_element1, blob_element2; |
| 80 blob_element1.SetToBytes( | 80 blob_element1.SetToBytes( |
| 81 blob_data->items().at(0).data.c_str() + | 81 blob_data->items().at(0).bytes() + |
| 82 static_cast<int>(blob_data->items().at(0).offset), | 82 static_cast<int>(blob_data->items().at(0).offset()), |
| 83 static_cast<int>(blob_data->items().at(0).length)); | 83 static_cast<int>(blob_data->items().at(0).length())); |
| 84 blob_element2.SetToFilePathRange( | 84 blob_element2.SetToFilePathRange( |
| 85 blob_data->items().at(1).file_path, | 85 blob_data->items().at(1).path(), |
| 86 blob_data->items().at(1).offset, | 86 blob_data->items().at(1).offset(), |
| 87 blob_data->items().at(1).length, | 87 blob_data->items().at(1).length(), |
| 88 blob_data->items().at(1).expected_modification_time); | 88 blob_data->items().at(1).expected_modification_time()); |
| 89 | 89 |
| 90 net::UploadElement upload_element1, upload_element2; | 90 net::UploadElement upload_element1, upload_element2; |
| 91 upload_element1.SetToBytes("Hello", 5); | 91 upload_element1.SetToBytes("Hello", 5); |
| 92 upload_element2.SetToFilePathRange( | 92 upload_element2.SetToFilePathRange( |
| 93 FilePath(FILE_PATH_LITERAL("foo1.txt")), 0, 20, time2); | 93 FilePath(FILE_PATH_LITERAL("foo1.txt")), 0, 20, time2); |
| 94 | 94 |
| 95 // Test no blob reference. | 95 // Test no blob reference. |
| 96 scoped_refptr<ResourceRequestBody> request_body(new ResourceRequestBody()); | 96 scoped_refptr<ResourceRequestBody> request_body(new ResourceRequestBody()); |
| 97 request_body->AppendBytes( | 97 request_body->AppendBytes( |
| 98 upload_element1.bytes(), | 98 upload_element1.bytes(), |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 EXPECT_TRUE(upload->elements()->at(1) == blob_element2); | 210 EXPECT_TRUE(upload->elements()->at(1) == blob_element2); |
| 211 EXPECT_TRUE(upload->elements()->at(2) == upload_element1); | 211 EXPECT_TRUE(upload->elements()->at(2) == upload_element1); |
| 212 EXPECT_TRUE(upload->elements()->at(3) == blob_element1); | 212 EXPECT_TRUE(upload->elements()->at(3) == blob_element1); |
| 213 EXPECT_TRUE(upload->elements()->at(4) == blob_element2); | 213 EXPECT_TRUE(upload->elements()->at(4) == blob_element2); |
| 214 EXPECT_TRUE(upload->elements()->at(5) == blob_element1); | 214 EXPECT_TRUE(upload->elements()->at(5) == blob_element1); |
| 215 EXPECT_TRUE(upload->elements()->at(6) == blob_element2); | 215 EXPECT_TRUE(upload->elements()->at(6) == blob_element2); |
| 216 EXPECT_TRUE(upload->elements()->at(7) == upload_element2); | 216 EXPECT_TRUE(upload->elements()->at(7) == upload_element2); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace webkit_glue | 219 } // namespace webkit_glue |
| OLD | NEW |