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

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

Issue 12225101: Implement GetInitiateUpload{New,Existing}FileUrl on Drive API v2. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_replace_url_to_resource_id_2
Patch Set: Created 7 years, 10 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
« 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 "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 url_generator_.GetFileTrashUrl("file:file_id").spec()); 169 url_generator_.GetFileTrashUrl("file:file_id").spec());
170 170
171 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0ADK06pfg/trash", 171 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0ADK06pfg/trash",
172 test_url_generator_.GetFileTrashUrl("0ADK06pfg").spec()); 172 test_url_generator_.GetFileTrashUrl("0ADK06pfg").spec());
173 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0Bz0bd074/trash", 173 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/0Bz0bd074/trash",
174 test_url_generator_.GetFileTrashUrl("0Bz0bd074").spec()); 174 test_url_generator_.GetFileTrashUrl("0Bz0bd074").spec());
175 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/file%3Afile_id/trash", 175 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files/file%3Afile_id/trash",
176 test_url_generator_.GetFileTrashUrl("file:file_id").spec()); 176 test_url_generator_.GetFileTrashUrl("file:file_id").spec());
177 } 177 }
178 178
179 TEST_F(DriveApiUrlGeneratorTest, GetInitiateUploadNewFileUrl) {
180 EXPECT_EQ(
181 "https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable",
182 url_generator_.GetInitiateUploadNewFileUrl().spec());
183
184 EXPECT_EQ(
185 "http://127.0.0.1:12345/upload/drive/v2/files?uploadType=resumable",
186 test_url_generator_.GetInitiateUploadNewFileUrl().spec());
187 }
188
189 TEST_F(DriveApiUrlGeneratorTest, GetInitiateUploadExistingFileUrl) {
190 // |resource_id| should be embedded into the url.
191 EXPECT_EQ(
192 "https://www.googleapis.com/upload/drive/v2/files/0ADK06pfg"
193 "?uploadType=resumable",
194 url_generator_.GetInitiateUploadExistingFileUrl("0ADK06pfg").spec());
195 EXPECT_EQ(
196 "https://www.googleapis.com/upload/drive/v2/files/0Bz0bd074"
197 "?uploadType=resumable",
198 url_generator_.GetInitiateUploadExistingFileUrl("0Bz0bd074").spec());
199 EXPECT_EQ(
200 "https://www.googleapis.com/upload/drive/v2/files/file%3Afile_id"
201 "?uploadType=resumable",
202 url_generator_.GetInitiateUploadExistingFileUrl("file:file_id").spec());
203
204 EXPECT_EQ(
205 "http://127.0.0.1:12345/upload/drive/v2/files/0ADK06pfg"
206 "?uploadType=resumable",
207 test_url_generator_.GetInitiateUploadExistingFileUrl(
208 "0ADK06pfg").spec());
209 EXPECT_EQ(
210 "http://127.0.0.1:12345/upload/drive/v2/files/0Bz0bd074"
211 "?uploadType=resumable",
212 test_url_generator_.GetInitiateUploadExistingFileUrl(
213 "0Bz0bd074").spec());
214 EXPECT_EQ(
215 "http://127.0.0.1:12345/upload/drive/v2/files/file%3Afile_id"
216 "?uploadType=resumable",
217 test_url_generator_.GetInitiateUploadExistingFileUrl(
218 "file:file_id").spec());
219 }
220
179 } // namespace google_apis 221 } // 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