| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/net/url_request_mock_http_job.h" | 10 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/common/notification_service.h" | 13 #include "chrome/common/notification_service.h" |
| 14 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/test/in_process_browser_test.h" | 15 #include "chrome/test/in_process_browser_test.h" |
| 15 #include "chrome/test/ui_test_utils.h" | 16 #include "chrome/test/ui_test_utils.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 #if !defined(OS_MACOSX) | 19 #if !defined(OS_MACOSX) |
| 19 // TODO(port): BUG16322 | 20 // TODO(port): BUG16322 |
| 20 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page"); | 21 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page"); |
| 21 | 22 |
| 22 static const char* kAppendedExtension = | 23 static const char* kAppendedExtension = |
| 23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 EXPECT_TRUE(file_util::ContentsEqual( | 130 EXPECT_TRUE(file_util::ContentsEqual( |
| 130 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), | 131 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), |
| 131 dir.AppendASCII("1.png"))); | 132 dir.AppendASCII("1.png"))); |
| 132 EXPECT_TRUE(file_util::ContentsEqual( | 133 EXPECT_TRUE(file_util::ContentsEqual( |
| 133 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), | 134 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), |
| 134 dir.AppendASCII("1.css"))); | 135 dir.AppendASCII("1.css"))); |
| 135 } | 136 } |
| 136 #endif // !defined(OS_MACOSX) | 137 #endif // !defined(OS_MACOSX) |
| 137 | 138 |
| 138 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { | 139 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { |
| 139 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 140 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); |
| 140 ASSERT_TRUE(browser()->command_updater()->SupportsCommand(IDC_SAVE_PAGE)); | 141 ASSERT_TRUE(browser()->command_updater()->SupportsCommand(IDC_SAVE_PAGE)); |
| 141 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE)); | 142 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE)); |
| 142 } | 143 } |
| 143 | 144 |
| 144 #if !defined(OS_MACOSX) | 145 #if !defined(OS_MACOSX) |
| 145 // TODO(port): BUG16322 | 146 // TODO(port): BUG16322 |
| 146 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { | 147 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { |
| 147 FilePath file_name(FILE_PATH_LITERAL("b.htm")); | 148 FilePath file_name(FILE_PATH_LITERAL("b.htm")); |
| 148 | 149 |
| 149 GURL url = URLRequestMockHTTPJob::GetMockUrl( | 150 GURL url = URLRequestMockHTTPJob::GetMockUrl( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 173 EXPECT_TRUE(file_util::ContentsEqual( | 174 EXPECT_TRUE(file_util::ContentsEqual( |
| 174 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), | 175 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), |
| 175 dir.AppendASCII("1.png"))); | 176 dir.AppendASCII("1.png"))); |
| 176 EXPECT_TRUE(file_util::ContentsEqual( | 177 EXPECT_TRUE(file_util::ContentsEqual( |
| 177 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), | 178 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), |
| 178 dir.AppendASCII("1.css"))); | 179 dir.AppendASCII("1.css"))); |
| 179 } | 180 } |
| 180 #endif // !defined(OS_MACOSX) | 181 #endif // !defined(OS_MACOSX) |
| 181 | 182 |
| 182 } // namespace | 183 } // namespace |
| OLD | NEW |