Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1131)

Side by Side Diff: chrome/browser/google_apis/drive_api_url_generator_unittest.cc

Issue 23575004: Refactor CreateDiretoryRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/google_apis/drive_api_url_generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/google_apis/drive_api_url_generator.h" 5 #include "chrome/browser/google_apis/drive_api_url_generator.h"
6 6
7 #include "chrome/browser/google_apis/test_util.h" 7 #include "chrome/browser/google_apis/test_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 23 matching lines...) Expand all
34 test_url_generator_.GetAboutGetUrl().spec()); 34 test_url_generator_.GetAboutGetUrl().spec());
35 } 35 }
36 36
37 TEST_F(DriveApiUrlGeneratorTest, GetAppsListUrl) { 37 TEST_F(DriveApiUrlGeneratorTest, GetAppsListUrl) {
38 EXPECT_EQ("https://www.googleapis.com/drive/v2/apps", 38 EXPECT_EQ("https://www.googleapis.com/drive/v2/apps",
39 url_generator_.GetAppsListUrl().spec()); 39 url_generator_.GetAppsListUrl().spec());
40 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/apps", 40 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/apps",
41 test_url_generator_.GetAppsListUrl().spec()); 41 test_url_generator_.GetAppsListUrl().spec());
42 } 42 }
43 43
44 TEST_F(DriveApiUrlGeneratorTest, GetFilesUrl) {
45 EXPECT_EQ("https://www.googleapis.com/drive/v2/files",
46 url_generator_.GetFilesUrl().spec());
47 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files",
48 test_url_generator_.GetFilesUrl().spec());
49 }
50
51 TEST_F(DriveApiUrlGeneratorTest, GetFilesGetUrl) { 44 TEST_F(DriveApiUrlGeneratorTest, GetFilesGetUrl) {
52 // |file_id| should be embedded into the url. 45 // |file_id| should be embedded into the url.
53 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/0ADK06pfg", 46 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/0ADK06pfg",
54 url_generator_.GetFilesGetUrl("0ADK06pfg").spec()); 47 url_generator_.GetFilesGetUrl("0ADK06pfg").spec());
55 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/0Bz0bd074", 48 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/0Bz0bd074",
56 url_generator_.GetFilesGetUrl("0Bz0bd074").spec()); 49 url_generator_.GetFilesGetUrl("0Bz0bd074").spec());
57 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/file%3Afile_id", 50 EXPECT_EQ("https://www.googleapis.com/drive/v2/files/file%3Afile_id",
58 url_generator_.GetFilesGetUrl("file:file_id").spec()); 51 url_generator_.GetFilesGetUrl("file:file_id").spec());
59 52
60 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0ADK06pfg", 53 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0ADK06pfg",
61 test_url_generator_.GetFilesGetUrl("0ADK06pfg").spec()); 54 test_url_generator_.GetFilesGetUrl("0ADK06pfg").spec());
62 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0Bz0bd074", 55 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0Bz0bd074",
63 test_url_generator_.GetFilesGetUrl("0Bz0bd074").spec()); 56 test_url_generator_.GetFilesGetUrl("0Bz0bd074").spec());
64 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/file%3Afile_id", 57 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/file%3Afile_id",
65 test_url_generator_.GetFilesGetUrl("file:file_id").spec()); 58 test_url_generator_.GetFilesGetUrl("file:file_id").spec());
66 } 59 }
67 60
61 TEST_F(DriveApiUrlGeneratorTest, GetFilesInsertUrl) {
62 EXPECT_EQ("https://www.googleapis.com/drive/v2/files",
63 url_generator_.GetFilesInsertUrl().spec());
64 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files",
65 test_url_generator_.GetFilesInsertUrl().spec());
66 }
67
68 TEST_F(DriveApiUrlGeneratorTest, GetFilePatchUrl) { 68 TEST_F(DriveApiUrlGeneratorTest, GetFilePatchUrl) {
69 struct TestPattern { 69 struct TestPattern {
70 bool set_modified_date; 70 bool set_modified_date;
71 bool update_viewed_date; 71 bool update_viewed_date;
72 const std::string expected_query; 72 const std::string expected_query;
73 }; 73 };
74 const TestPattern kTestPatterns[] = { 74 const TestPattern kTestPatterns[] = {
75 { false, true, "" }, 75 { false, true, "" },
76 { true, true, "?setModifiedDate=true" }, 76 { true, true, "?setModifiedDate=true" },
77 { false, false, "?updateViewedDate=false" }, 77 { false, false, "?updateViewedDate=false" },
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 url_generator_.GenerateDownloadFileUrl("resourceId").spec()); 393 url_generator_.GenerateDownloadFileUrl("resourceId").spec());
394 EXPECT_EQ( 394 EXPECT_EQ(
395 "https://www.googledrive.com/host/file%3AresourceId", 395 "https://www.googledrive.com/host/file%3AresourceId",
396 url_generator_.GenerateDownloadFileUrl("file:resourceId").spec()); 396 url_generator_.GenerateDownloadFileUrl("file:resourceId").spec());
397 EXPECT_EQ( 397 EXPECT_EQ(
398 "http://127.0.0.1:12345/download/resourceId", 398 "http://127.0.0.1:12345/download/resourceId",
399 test_url_generator_.GenerateDownloadFileUrl("resourceId").spec()); 399 test_url_generator_.GenerateDownloadFileUrl("resourceId").spec());
400 } 400 }
401 401
402 } // namespace google_apis 402 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_api_url_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698