| OLD | NEW |
| 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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
| 237 #define MAYBE_TestLongSafePureFilename DISABLED_TestLongSafePureFilename | 237 #define MAYBE_TestLongSafePureFilename DISABLED_TestLongSafePureFilename |
| 238 #else | 238 #else |
| 239 #define MAYBE_TestLongSafePureFilename TestLongSafePureFilename | 239 #define MAYBE_TestLongSafePureFilename TestLongSafePureFilename |
| 240 #endif | 240 #endif |
| 241 TEST_F(SavePackageTest, MAYBE_TestLongSafePureFilename) { | 241 TEST_F(SavePackageTest, MAYBE_TestLongSafePureFilename) { |
| 242 const base::FilePath save_dir(FPL("test_dir")); | 242 const base::FilePath save_dir(FPL("test_dir")); |
| 243 const base::FilePath::StringType ext(FPL_HTML_EXTENSION); | 243 const base::FilePath::StringType ext(FPL_HTML_EXTENSION); |
| 244 base::FilePath::StringType filename = | 244 base::FilePath::StringType filename = |
| 245 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
| 246 base::ASCIIToWide(long_file_name); | 246 base::ASCIIToUTF16(long_file_name); |
| 247 #else | 247 #else |
| 248 long_file_name; | 248 long_file_name; |
| 249 #endif | 249 #endif |
| 250 | 250 |
| 251 // Test that the filename + extension doesn't exceed kMaxFileNameLength | 251 // Test that the filename + extension doesn't exceed kMaxFileNameLength |
| 252 uint32 max_path = SavePackage::GetMaxPathLengthForDirectory(save_dir); | 252 uint32 max_path = SavePackage::GetMaxPathLengthForDirectory(save_dir); |
| 253 ASSERT_TRUE(SavePackage::GetSafePureFileName(save_dir, ext, max_path, | 253 ASSERT_TRUE(SavePackage::GetSafePureFileName(save_dir, ext, max_path, |
| 254 &filename)); | 254 &filename)); |
| 255 EXPECT_TRUE(filename.length() <= kMaxFileNameLength-ext.length()); | 255 EXPECT_TRUE(filename.length() <= kMaxFileNameLength-ext.length()); |
| 256 } | 256 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 GURL view_source_url = | 432 GURL view_source_url = |
| 433 GURL(kViewSourceScheme + std::string(":") + mock_url.spec()); | 433 GURL(kViewSourceScheme + std::string(":") + mock_url.spec()); |
| 434 GURL actual_url = net::URLRequestMockHTTPJob::GetMockUrl( | 434 GURL actual_url = net::URLRequestMockHTTPJob::GetMockUrl( |
| 435 base::FilePath(kTestDir).Append(file_name)); | 435 base::FilePath(kTestDir).Append(file_name)); |
| 436 NavigateAndCommit(view_source_url); | 436 NavigateAndCommit(view_source_url); |
| 437 EXPECT_EQ(actual_url, GetUrlToBeSaved()); | 437 EXPECT_EQ(actual_url, GetUrlToBeSaved()); |
| 438 EXPECT_EQ(view_source_url, contents()->GetLastCommittedURL()); | 438 EXPECT_EQ(view_source_url, contents()->GetLastCommittedURL()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace content | 441 } // namespace content |
| OLD | NEW |