| 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/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "base/scoped_temp_dir.h" | |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "content/browser/browser_thread_impl.h" | 12 #include "content/browser/browser_thread_impl.h" |
| 13 #include "content/browser/download/save_package.h" | 13 #include "content/browser/download/save_package.h" |
| 14 #include "content/browser/renderer_host/test_render_view_host.h" | 14 #include "content/browser/renderer_host/test_render_view_host.h" |
| 15 #include "content/browser/web_contents/test_web_contents.h" | 15 #include "content/browser/web_contents/test_web_contents.h" |
| 16 #include "content/test/net/url_request_mock_http_job.h" | 16 #include "content/test/net/url_request_mock_http_job.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 BrowserThreadImpl browser_thread_; | 124 BrowserThreadImpl browser_thread_; |
| 125 | 125 |
| 126 // SavePackage for successfully generating file name. | 126 // SavePackage for successfully generating file name. |
| 127 scoped_refptr<SavePackage> save_package_success_; | 127 scoped_refptr<SavePackage> save_package_success_; |
| 128 // SavePackage for failed generating file name. | 128 // SavePackage for failed generating file name. |
| 129 scoped_refptr<SavePackage> save_package_fail_; | 129 scoped_refptr<SavePackage> save_package_fail_; |
| 130 | 130 |
| 131 ScopedTempDir temp_dir_; | 131 base::ScopedTempDir temp_dir_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(SavePackageTest); | 133 DISALLOW_COPY_AND_ASSIGN(SavePackageTest); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 static const struct { | 136 static const struct { |
| 137 const char* disposition; | 137 const char* disposition; |
| 138 const char* url; | 138 const char* url; |
| 139 const FilePath::CharType* expected_name; | 139 const FilePath::CharType* expected_name; |
| 140 bool need_htm_ext; | 140 bool need_htm_ext; |
| 141 } kGeneratedFiles[] = { | 141 } kGeneratedFiles[] = { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( | 421 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( |
| 422 FilePath(kTestDir).Append(file_name)); | 422 FilePath(kTestDir).Append(file_name)); |
| 423 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( | 423 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( |
| 424 FilePath(kTestDir).Append(file_name)); | 424 FilePath(kTestDir).Append(file_name)); |
| 425 NavigateAndCommit(view_source_url); | 425 NavigateAndCommit(view_source_url); |
| 426 EXPECT_EQ(actual_url, GetUrlToBeSaved()); | 426 EXPECT_EQ(actual_url, GetUrlToBeSaved()); |
| 427 EXPECT_EQ(view_source_url, contents()->GetURL()); | 427 EXPECT_EQ(view_source_url, contents()->GetURL()); |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace content | 430 } // namespace content |
| OLD | NEW |