| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/download/save_package.h" | 11 #include "chrome/browser/download/save_package.h" |
| 12 #include "chrome/browser/net/url_request_mock_http_job.h" | 12 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 13 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 13 #include "content/browser/renderer_host/test_render_view_host.h" |
| 14 #include "chrome/browser/tab_contents/test_tab_contents.h" | 14 #include "content/browser/tab_contents/test_tab_contents.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 #define FPL FILE_PATH_LITERAL | 18 #define FPL FILE_PATH_LITERAL |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #define HTML_EXTENSION ".htm" | 20 #define HTML_EXTENSION ".htm" |
| 21 // This second define is needed because MSVC is broken. | 21 // This second define is needed because MSVC is broken. |
| 22 #define FPL_HTML_EXTENSION L".htm" | 22 #define FPL_HTML_EXTENSION L".htm" |
| 23 #else | 23 #else |
| 24 #define HTML_EXTENSION ".html" | 24 #define HTML_EXTENSION ".html" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 TEST_F(SavePackageTest, TestGetUrlToBeSavedViewSource) { | 381 TEST_F(SavePackageTest, TestGetUrlToBeSavedViewSource) { |
| 382 FilePath file_name(FILE_PATH_LITERAL("a.htm")); | 382 FilePath file_name(FILE_PATH_LITERAL("a.htm")); |
| 383 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( | 383 GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( |
| 384 FilePath(kTestDir).Append(file_name)); | 384 FilePath(kTestDir).Append(file_name)); |
| 385 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( | 385 GURL actual_url = URLRequestMockHTTPJob::GetMockUrl( |
| 386 FilePath(kTestDir).Append(file_name)); | 386 FilePath(kTestDir).Append(file_name)); |
| 387 NavigateAndCommit(view_source_url); | 387 NavigateAndCommit(view_source_url); |
| 388 EXPECT_EQ(actual_url, GetUrlToBeSaved()); | 388 EXPECT_EQ(actual_url, GetUrlToBeSaved()); |
| 389 EXPECT_EQ(view_source_url, contents()->GetURL()); | 389 EXPECT_EQ(view_source_url, contents()->GetURL()); |
| 390 } | 390 } |
| OLD | NEW |