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

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

Issue 22909041: Refactor GetAboutRequest and GetApplistRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
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
11 namespace google_apis { 11 namespace google_apis {
12 12
13 class DriveApiUrlGeneratorTest : public testing::Test { 13 class DriveApiUrlGeneratorTest : public testing::Test {
14 public: 14 public:
15 DriveApiUrlGeneratorTest() 15 DriveApiUrlGeneratorTest()
16 : url_generator_( 16 : url_generator_(
17 GURL(DriveApiUrlGenerator::kBaseUrlForProduction), 17 GURL(DriveApiUrlGenerator::kBaseUrlForProduction),
18 GURL(DriveApiUrlGenerator::kBaseDownloadUrlForProduction)), 18 GURL(DriveApiUrlGenerator::kBaseDownloadUrlForProduction)),
19 test_url_generator_( 19 test_url_generator_(
20 test_util::GetBaseUrlForTesting(12345), 20 test_util::GetBaseUrlForTesting(12345),
21 test_util::GetBaseUrlForTesting(12345).Resolve("download/")) { 21 test_util::GetBaseUrlForTesting(12345).Resolve("download/")) {
22 } 22 }
23 23
24 protected: 24 protected:
25 DriveApiUrlGenerator url_generator_; 25 DriveApiUrlGenerator url_generator_;
26 DriveApiUrlGenerator test_url_generator_; 26 DriveApiUrlGenerator test_url_generator_;
27 }; 27 };
28 28
29 // Make sure the hard-coded urls are returned. 29 // Make sure the hard-coded urls are returned.
30 TEST_F(DriveApiUrlGeneratorTest, GetAboutUrl) { 30 TEST_F(DriveApiUrlGeneratorTest, GetAboutGetUrl) {
31 EXPECT_EQ("https://www.googleapis.com/drive/v2/about", 31 EXPECT_EQ("https://www.googleapis.com/drive/v2/about",
32 url_generator_.GetAboutUrl().spec()); 32 url_generator_.GetAboutGetUrl().spec());
33 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/about", 33 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/about",
34 test_url_generator_.GetAboutUrl().spec()); 34 test_url_generator_.GetAboutGetUrl().spec());
35 } 35 }
36 36
37 TEST_F(DriveApiUrlGeneratorTest, GetApplistUrl) { 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_.GetApplistUrl().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_.GetApplistUrl().spec()); 41 test_url_generator_.GetAppsListUrl().spec());
42 } 42 }
43 43
44 TEST_F(DriveApiUrlGeneratorTest, GetChangelistUrl) { 44 TEST_F(DriveApiUrlGeneratorTest, GetChangelistUrl) {
45 // Do not add startChangeId parameter if |start_changestamp| is 0. 45 // Do not add startChangeId parameter if |start_changestamp| is 0.
46 EXPECT_EQ("https://www.googleapis.com/drive/v2/changes?maxResults=500", 46 EXPECT_EQ("https://www.googleapis.com/drive/v2/changes?maxResults=500",
47 url_generator_.GetChangelistUrl(true, 0, 500).spec()); 47 url_generator_.GetChangelistUrl(true, 0, 500).spec());
48 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/changes?maxResults=500", 48 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/changes?maxResults=500",
49 test_url_generator_.GetChangelistUrl(true, 0, 500).spec()); 49 test_url_generator_.GetChangelistUrl(true, 0, 500).spec());
50 50
51 // Set includeDeleted parameter if |include_deleted| is set to false. 51 // Set includeDeleted parameter if |include_deleted| is set to false.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 url_generator_.GenerateDownloadFileUrl("resourceId").spec()); 266 url_generator_.GenerateDownloadFileUrl("resourceId").spec());
267 EXPECT_EQ( 267 EXPECT_EQ(
268 "https://www.googledrive.com/host/file%3AresourceId", 268 "https://www.googledrive.com/host/file%3AresourceId",
269 url_generator_.GenerateDownloadFileUrl("file:resourceId").spec()); 269 url_generator_.GenerateDownloadFileUrl("file:resourceId").spec());
270 EXPECT_EQ( 270 EXPECT_EQ(
271 "http://127.0.0.1:12345/download/resourceId", 271 "http://127.0.0.1:12345/download/resourceId",
272 test_url_generator_.GenerateDownloadFileUrl("resourceId").spec()); 272 test_url_generator_.GenerateDownloadFileUrl("resourceId").spec());
273 } 273 }
274 274
275 } // namespace google_apis 275 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_api_url_generator.cc ('k') | chrome/browser/google_apis/drive_common_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698