Chromium Code Reviews| 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/file_path.h" | 7 #include "base/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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 |
| 103 // Do the initialization in SetUp so contents() is initialized by | 103 // Do the initialization in SetUp so contents() is initialized by |
| 104 // RenderViewHostImplTestHarness::SetUp. | 104 // RenderViewHostImplTestHarness::SetUp. |
| 105 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 105 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 106 | 106 |
| 107 save_package_success_ = new SavePackage(contents(), | 107 save_package_success_ = new SavePackage(contents(), |
| 108 temp_dir_.path().AppendASCII("testfile" HTML_EXTENSION), | 108 temp_dir_.path().AppendASCII("testfile" HTML_EXTENSION), |
| 109 temp_dir_.path().AppendASCII("testfile_files")); | 109 temp_dir_.path().AppendASCII("testfile_files")); |
| 110 | 110 |
| 111 // We need to construct a path that is *almost* kMaxFilePathLength long | 111 // We need to construct a path that is *almost* kMaxFilePathLength long |
| 112 long_file_name.resize(kMaxFilePathLength + long_file_name.length()); | 112 long_file_name.reserve(kMaxFilePathLength + long_file_name.length()); |
|
aedla
2013/01/28 11:40:15
Looks like reserve was intended here. Because othe
| |
| 113 while (long_file_name.length() < kMaxFilePathLength) | 113 while (long_file_name.length() < kMaxFilePathLength) |
| 114 long_file_name += long_file_name; | 114 long_file_name += long_file_name; |
| 115 long_file_name.resize( | 115 long_file_name.resize( |
| 116 kMaxFilePathLength - 9 - temp_dir_.path().value().length()); | 116 kMaxFilePathLength - 9 - temp_dir_.path().value().length()); |
| 117 | 117 |
| 118 save_package_fail_ = new SavePackage(contents(), | 118 save_package_fail_ = new SavePackage(contents(), |
| 119 temp_dir_.path().AppendASCII(long_file_name + HTML_EXTENSION), | 119 temp_dir_.path().AppendASCII(long_file_name + HTML_EXTENSION), |
| 120 temp_dir_.path().AppendASCII(long_file_name + "_files")); | 120 temp_dir_.path().AppendASCII(long_file_name + "_files")); |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( | 434 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( |
| 435 FilePath(kTestDir).Append(file_name)); | 435 FilePath(kTestDir).Append(file_name)); |
| 436 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( | 436 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( |
| 437 FilePath(kTestDir).Append(file_name)); | 437 FilePath(kTestDir).Append(file_name)); |
| 438 NavigateAndCommit(view_source_url); | 438 NavigateAndCommit(view_source_url); |
| 439 EXPECT_EQ(actual_url, GetUrlToBeSaved()); | 439 EXPECT_EQ(actual_url, GetUrlToBeSaved()); |
| 440 EXPECT_EQ(view_source_url, contents()->GetURL()); | 440 EXPECT_EQ(view_source_url, contents()->GetURL()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace content | 443 } // namespace content |
| OLD | NEW |