OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync/core/attachments/attachment_uploader_impl.h" | 5 #include "components/sync/core/attachments/attachment_uploader_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "google_apis/gaia/gaia_constants.h" | 31 #include "google_apis/gaia/gaia_constants.h" |
32 #include "google_apis/gaia/oauth2_token_service_request.h" | 32 #include "google_apis/gaia/oauth2_token_service_request.h" |
33 #include "net/http/http_status_code.h" | 33 #include "net/http/http_status_code.h" |
34 #include "net/test/embedded_test_server/embedded_test_server.h" | 34 #include "net/test/embedded_test_server/embedded_test_server.h" |
35 #include "net/test/embedded_test_server/http_request.h" | 35 #include "net/test/embedded_test_server/http_request.h" |
36 #include "net/test/embedded_test_server/http_response.h" | 36 #include "net/test/embedded_test_server/http_response.h" |
37 #include "net/url_request/url_request_test_util.h" | 37 #include "net/url_request/url_request_test_util.h" |
38 #include "testing/gmock/include/gmock/gmock-matchers.h" | 38 #include "testing/gmock/include/gmock/gmock-matchers.h" |
39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
40 | 40 |
| 41 namespace syncer { |
| 42 |
41 namespace { | 43 namespace { |
42 | 44 |
43 const char kAttachmentData[] = "some data"; | 45 const char kAttachmentData[] = "some data"; |
44 const char kAccountId[] = "some-account-id"; | 46 const char kAccountId[] = "some-account-id"; |
45 const char kAccessToken[] = "some-access-token"; | 47 const char kAccessToken[] = "some-access-token"; |
46 const char kContentTypeValue[] = "application/octet-stream"; | 48 const char kContentTypeValue[] = "application/octet-stream"; |
47 const char kXGoogHash[] = "X-Goog-Hash"; | 49 const char kXGoogHash[] = "X-Goog-Hash"; |
48 const char kAttachments[] = "/attachments/"; | 50 const char kAttachments[] = "/attachments/"; |
49 const char kStoreBirthday[] = | 51 const char kStoreBirthday[] = |
50 "\x46\xFF\xDD\xE0\x74\x3A\x48\xFD\x9D\x06\x93\x3C\x61\x8E\xA5\x70\x09\x59" | 52 "\x46\xFF\xDD\xE0\x74\x3A\x48\xFD\x9D\x06\x93\x3C\x61\x8E\xA5\x70\x09\x59" |
51 "\x99\x05\x61\x46\x21\x61\x1B\x03\xD3\x02\x60\xCD\x41\x55\xFE\x26\x15\xD7" | 53 "\x99\x05\x61\x46\x21\x61\x1B\x03\xD3\x02\x60\xCD\x41\x55\xFE\x26\x15\xD7" |
52 "\x0C"; | 54 "\x0C"; |
53 const char kBase64URLSafeStoreBirthday[] = | 55 const char kBase64URLSafeStoreBirthday[] = |
54 "Rv_d4HQ6SP2dBpM8YY6lcAlZmQVhRiFhGwPTAmDNQVX-JhXXDA"; | 56 "Rv_d4HQ6SP2dBpM8YY6lcAlZmQVhRiFhGwPTAmDNQVX-JhXXDA"; |
55 const char kSyncStoreBirthdayHeader[] = "X-Sync-Store-Birthday"; | 57 const char kSyncStoreBirthdayHeader[] = "X-Sync-Store-Birthday"; |
56 const char kSyncDataTypeIdHeader[] = "X-Sync-Data-Type-Id"; | 58 const char kSyncDataTypeIdHeader[] = "X-Sync-Data-Type-Id"; |
57 const syncer::ModelType kModelType = syncer::ModelType::ARTICLES; | 59 const ModelType kModelType = ModelType::ARTICLES; |
58 | 60 |
59 } // namespace | 61 } // namespace |
60 | 62 |
61 namespace syncer { | |
62 | |
63 using net::test_server::BasicHttpResponse; | 63 using net::test_server::BasicHttpResponse; |
64 using net::test_server::HttpRequest; | 64 using net::test_server::HttpRequest; |
65 using net::test_server::HttpResponse; | 65 using net::test_server::HttpResponse; |
66 | 66 |
67 class RequestHandler; | 67 class RequestHandler; |
68 | 68 |
69 // A mock implementation of an OAuth2TokenService. | 69 // A mock implementation of an OAuth2TokenService. |
70 // | 70 // |
71 // Use |SetResponse| to vary the response to token requests. | 71 // Use |SetResponse| to vary the response to token requests. |
72 // | 72 // |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); | 667 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); |
668 hello_world->data() = "hello world"; | 668 hello_world->data() = "hello world"; |
669 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( | 669 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( |
670 ComputeCrc32c(hello_world))); | 670 ComputeCrc32c(hello_world))); |
671 } | 671 } |
672 | 672 |
673 // TODO(maniscalco): Add test case for when we are uploading an attachment that | 673 // TODO(maniscalco): Add test case for when we are uploading an attachment that |
674 // already exists. 409 Conflict? (bug 379825) | 674 // already exists. 409 Conflict? (bug 379825) |
675 | 675 |
676 } // namespace syncer | 676 } // namespace syncer |
OLD | NEW |