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

Side by Side Diff: content/browser/download/save_package_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 #else 214 #else
215 #define MAYBE_TestLongSavePackageFilename TestLongSavePackageFilename 215 #define MAYBE_TestLongSavePackageFilename TestLongSavePackageFilename
216 #endif 216 #endif
217 TEST_F(SavePackageTest, MAYBE_TestLongSavePackageFilename) { 217 TEST_F(SavePackageTest, MAYBE_TestLongSavePackageFilename) {
218 const std::string base_url("http://www.google.com/"); 218 const std::string base_url("http://www.google.com/");
219 const std::string long_file = long_file_name + ".css"; 219 const std::string long_file = long_file_name + ".css";
220 const std::string url = base_url + long_file; 220 const std::string url = base_url + long_file;
221 221
222 base::FilePath::StringType filename; 222 base::FilePath::StringType filename;
223 // Test that the filename is successfully shortened to fit. 223 // Test that the filename is successfully shortened to fit.
224 ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename)); 224 ASSERT_TRUE(GetGeneratedFilename(true, std::string(), url, false, &filename));
225 EXPECT_TRUE(filename.length() < long_file.length()); 225 EXPECT_TRUE(filename.length() < long_file.length());
226 EXPECT_FALSE(HasOrdinalNumber(filename)); 226 EXPECT_FALSE(HasOrdinalNumber(filename));
227 227
228 // Test that the filename is successfully shortened to fit, and gets an 228 // Test that the filename is successfully shortened to fit, and gets an
229 // an ordinal appended. 229 // an ordinal appended.
230 ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename)); 230 ASSERT_TRUE(GetGeneratedFilename(true, std::string(), url, false, &filename));
231 EXPECT_TRUE(filename.length() < long_file.length()); 231 EXPECT_TRUE(filename.length() < long_file.length());
232 EXPECT_TRUE(HasOrdinalNumber(filename)); 232 EXPECT_TRUE(HasOrdinalNumber(filename));
233 233
234 // Test that the filename is successfully shortened to fit, and gets a 234 // Test that the filename is successfully shortened to fit, and gets a
235 // different ordinal appended. 235 // different ordinal appended.
236 base::FilePath::StringType filename2; 236 base::FilePath::StringType filename2;
237 ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename2)); 237 ASSERT_TRUE(
238 GetGeneratedFilename(true, std::string(), url, false, &filename2));
238 EXPECT_TRUE(filename2.length() < long_file.length()); 239 EXPECT_TRUE(filename2.length() < long_file.length());
239 EXPECT_TRUE(HasOrdinalNumber(filename2)); 240 EXPECT_TRUE(HasOrdinalNumber(filename2));
240 EXPECT_NE(filename, filename2); 241 EXPECT_NE(filename, filename2);
241 } 242 }
242 243
243 // Crashing on Windows, see http://crbug.com/79365 244 // Crashing on Windows, see http://crbug.com/79365
244 #if defined(OS_WIN) 245 #if defined(OS_WIN)
245 #define MAYBE_TestLongSafePureFilename DISABLED_TestLongSafePureFilename 246 #define MAYBE_TestLongSafePureFilename DISABLED_TestLongSafePureFilename
246 #else 247 #else
247 #define MAYBE_TestLongSafePureFilename TestLongSafePureFilename 248 #define MAYBE_TestLongSafePureFilename TestLongSafePureFilename
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( 439 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl(
439 base::FilePath(kTestDir).Append(file_name)); 440 base::FilePath(kTestDir).Append(file_name));
440 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( 441 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl(
441 base::FilePath(kTestDir).Append(file_name)); 442 base::FilePath(kTestDir).Append(file_name));
442 NavigateAndCommit(view_source_url); 443 NavigateAndCommit(view_source_url);
443 EXPECT_EQ(actual_url, GetUrlToBeSaved()); 444 EXPECT_EQ(actual_url, GetUrlToBeSaved());
444 EXPECT_EQ(view_source_url, contents()->GetURL()); 445 EXPECT_EQ(view_source_url, contents()->GetURL());
445 } 446 }
446 447
447 } // namespace content 448 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_package.cc ('k') | content/browser/geolocation/network_location_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698