| 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 "google_apis/drive/drive_api_url_generator.h" | 5 #include "google_apis/drive/drive_api_url_generator.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 7 #include "google_apis/drive/test_util.h" | 11 #include "google_apis/drive/test_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 10 #include "url/url_util.h" | 14 #include "url/url_util.h" |
| 11 | 15 |
| 12 namespace google_apis { | 16 namespace google_apis { |
| 13 namespace { | 17 namespace { |
| 14 // The URLs used for production may be different for Chromium OS and Chrome | 18 // The URLs used for production may be different for Chromium OS and Chrome |
| 15 // OS, so use testing base urls. | 19 // OS, so use testing base urls. |
| 16 const char kBaseUrlForTesting[] = "https://www.example.com"; | 20 const char kBaseUrlForTesting[] = "https://www.example.com"; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 url_generator_.GetFilesTrashUrl("0Bz0bd074").spec()); | 198 url_generator_.GetFilesTrashUrl("0Bz0bd074").spec()); |
| 195 EXPECT_EQ("https://www.example.com/drive/v2/files/file%3Afile_id/trash", | 199 EXPECT_EQ("https://www.example.com/drive/v2/files/file%3Afile_id/trash", |
| 196 url_generator_.GetFilesTrashUrl("file:file_id").spec()); | 200 url_generator_.GetFilesTrashUrl("file:file_id").spec()); |
| 197 } | 201 } |
| 198 | 202 |
| 199 TEST_F(DriveApiUrlGeneratorTest, GetChangesListUrl) { | 203 TEST_F(DriveApiUrlGeneratorTest, GetChangesListUrl) { |
| 200 struct TestPattern { | 204 struct TestPattern { |
| 201 bool include_deleted; | 205 bool include_deleted; |
| 202 int max_results; | 206 int max_results; |
| 203 const std::string page_token; | 207 const std::string page_token; |
| 204 int64 start_change_id; | 208 int64_t start_change_id; |
| 205 const std::string expected_query; | 209 const std::string expected_query; |
| 206 }; | 210 }; |
| 207 const TestPattern kTestPatterns[] = { | 211 const TestPattern kTestPatterns[] = { |
| 208 { true, 100, "", 0, "" }, | 212 { true, 100, "", 0, "" }, |
| 209 { false, 100, "", 0, "?includeDeleted=false" }, | 213 { false, 100, "", 0, "?includeDeleted=false" }, |
| 210 { true, 150, "", 0, "?maxResults=150" }, | 214 { true, 150, "", 0, "?maxResults=150" }, |
| 211 { false, 150, "", 0, "?includeDeleted=false&maxResults=150" }, | 215 { false, 150, "", 0, "?includeDeleted=false&maxResults=150" }, |
| 212 { true, 10, "", 0, "?maxResults=10" }, | 216 { true, 10, "", 0, "?maxResults=10" }, |
| 213 { false, 10, "", 0, "?includeDeleted=false&maxResults=10" }, | 217 { false, 10, "", 0, "?includeDeleted=false&maxResults=10" }, |
| 214 | 218 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 "https://thumbnail.example.com/d/0ADK06pfg=w360-h380-c", | 382 "https://thumbnail.example.com/d/0ADK06pfg=w360-h380-c", |
| 379 url_generator_.GetThumbnailUrl("0ADK06pfg", 360, 380, true).spec()); | 383 url_generator_.GetThumbnailUrl("0ADK06pfg", 360, 380, true).spec()); |
| 380 } | 384 } |
| 381 | 385 |
| 382 TEST_F(DriveApiUrlGeneratorTest, BatchUploadUrl) { | 386 TEST_F(DriveApiUrlGeneratorTest, BatchUploadUrl) { |
| 383 EXPECT_EQ("https://www.example.com/upload/drive", | 387 EXPECT_EQ("https://www.example.com/upload/drive", |
| 384 url_generator_.GetBatchUploadUrl().spec()); | 388 url_generator_.GetBatchUploadUrl().spec()); |
| 385 } | 389 } |
| 386 | 390 |
| 387 } // namespace google_apis | 391 } // namespace google_apis |
| OLD | NEW |