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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 "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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 test_url_generator_.GetChangelistUrl(GURL(), 100).spec()); 62 test_url_generator_.GetChangelistUrl(GURL(), 100).spec());
63 EXPECT_EQ("https://localhost/drive/v2/changes?startChangeId=200", 63 EXPECT_EQ("https://localhost/drive/v2/changes?startChangeId=200",
64 test_url_generator_.GetChangelistUrl( 64 test_url_generator_.GetChangelistUrl(
65 GURL("https://localhost/drive/v2/changes"), 200).spec()); 65 GURL("https://localhost/drive/v2/changes"), 200).spec());
66 } 66 }
67 67
68 TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) { 68 TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) {
69 // Use default URL, if |override_url| is empty. 69 // Use default URL, if |override_url| is empty.
70 // Do not add q parameter if |search_string| is empty. 70 // Do not add q parameter if |search_string| is empty.
71 EXPECT_EQ("https://www.googleapis.com/drive/v2/files", 71 EXPECT_EQ("https://www.googleapis.com/drive/v2/files",
72 url_generator_.GetFilelistUrl(GURL(), "").spec()); 72 url_generator_.GetFilelistUrl(GURL(), std::string()).spec());
73 73
74 // Set q parameter if non-empty |search_string| is given. 74 // Set q parameter if non-empty |search_string| is given.
75 EXPECT_EQ("https://www.googleapis.com/drive/v2/files?q=query", 75 EXPECT_EQ("https://www.googleapis.com/drive/v2/files?q=query",
76 url_generator_.GetFilelistUrl(GURL(), "query").spec()); 76 url_generator_.GetFilelistUrl(GURL(), "query").spec());
77 77
78 // Use the |override_url| for the base URL if given. 78 // Use the |override_url| for the base URL if given.
79 // The behavior for the |search_string| should be as same as above cases. 79 // The behavior for the |search_string| should be as same as above cases.
80 EXPECT_EQ("https://localhost/drive/v2/files", 80 EXPECT_EQ(
81 url_generator_.GetFilelistUrl( 81 "https://localhost/drive/v2/files",
82 GURL("https://localhost/drive/v2/files"), "").spec()); 82 url_generator_.GetFilelistUrl(GURL("https://localhost/drive/v2/files"),
83 std::string()).spec());
83 EXPECT_EQ("https://localhost/drive/v2/files?q=query", 84 EXPECT_EQ("https://localhost/drive/v2/files?q=query",
84 url_generator_.GetFilelistUrl( 85 url_generator_.GetFilelistUrl(
85 GURL("https://localhost/drive/v2/files"), "query").spec()); 86 GURL("https://localhost/drive/v2/files"), "query").spec());
86 87
87 // For test server, the given base url should be used, 88 // For test server, the given base url should be used,
88 // but if |override_url| is given, |override_url| should be used. 89 // but if |override_url| is given, |override_url| should be used.
89 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files?q=query", 90 EXPECT_EQ("http://127.0.0.1:12345/drive/v2/files?q=query",
90 test_url_generator_.GetFilelistUrl(GURL(), "query").spec()); 91 test_url_generator_.GetFilelistUrl(GURL(), "query").spec());
91 EXPECT_EQ("https://localhost/drive/v2/files?q=query", 92 EXPECT_EQ("https://localhost/drive/v2/files?q=query",
92 test_url_generator_.GetFilelistUrl( 93 test_url_generator_.GetFilelistUrl(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 test_url_generator_.GetInitiateUploadExistingFileUrl( 230 test_url_generator_.GetInitiateUploadExistingFileUrl(
230 "0Bz0bd074").spec()); 231 "0Bz0bd074").spec());
231 EXPECT_EQ( 232 EXPECT_EQ(
232 "http://127.0.0.1:12345/upload/drive/v2/files/file%3Afile_id" 233 "http://127.0.0.1:12345/upload/drive/v2/files/file%3Afile_id"
233 "?uploadType=resumable", 234 "?uploadType=resumable",
234 test_url_generator_.GetInitiateUploadExistingFileUrl( 235 test_url_generator_.GetInitiateUploadExistingFileUrl(
235 "file:file_id").spec()); 236 "file:file_id").spec());
236 } 237 }
237 238
238 } // namespace google_apis 239 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_api_operations_unittest.cc ('k') | chrome/browser/google_apis/drive_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698