Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 10815024: Revert 147594 - NaCl: Remove two uses of '#include "nacl/nacl_log.h"' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 345 }
346 346
347 // This tests that a webpage with the title "test.exe" is saved as 347 // This tests that a webpage with the title "test.exe" is saved as
348 // "test.exe.htm". 348 // "test.exe.htm".
349 // We probably don't care to handle this on Linux or Mac. 349 // We probably don't care to handle this on Linux or Mac.
350 #if defined(OS_WIN) 350 #if defined(OS_WIN)
351 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { 351 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) {
352 const FilePath file_name(FILE_PATH_LITERAL("c.htm")); 352 const FilePath file_name(FILE_PATH_LITERAL("c.htm"));
353 FilePath download_dir = 353 FilePath download_dir =
354 DownloadPrefs::FromDownloadManager(GetDownloadManager())-> 354 DownloadPrefs::FromDownloadManager(GetDownloadManager())->
355 download_path(); 355 DownloadPath();
356 FilePath full_file_name = 356 FilePath full_file_name =
357 download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); 357 download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension);
358 FilePath dir = download_dir.AppendASCII("test.exe_files"); 358 FilePath dir = download_dir.AppendASCII("test.exe_files");
359 359
360 EXPECT_FALSE(file_util::PathExists(full_file_name)); 360 EXPECT_FALSE(file_util::PathExists(full_file_name));
361 GURL url = URLRequestMockHTTPJob::GetMockUrl( 361 GURL url = URLRequestMockHTTPJob::GetMockUrl(
362 FilePath(kTestDir).Append(file_name)); 362 FilePath(kTestDir).Append(file_name));
363 ui_test_utils::NavigateToURL(browser(), url); 363 ui_test_utils::NavigateToURL(browser(), url);
364 364
365 SavePackageFilePicker::SetShouldPromptUser(false); 365 SavePackageFilePicker::SetShouldPromptUser(false);
(...skipping 22 matching lines...) Expand all
388 DISALLOW_COPY_AND_ASSIGN(SavePageAsMHTMLBrowserTest); 388 DISALLOW_COPY_AND_ASSIGN(SavePageAsMHTMLBrowserTest);
389 }; 389 };
390 390
391 SavePageAsMHTMLBrowserTest::~SavePageAsMHTMLBrowserTest() { 391 SavePageAsMHTMLBrowserTest::~SavePageAsMHTMLBrowserTest() {
392 } 392 }
393 393
394 IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { 394 IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) {
395 static const int64 kFileSizeMin = 2758; 395 static const int64 kFileSizeMin = 2758;
396 GURL url = NavigateToMockURL("b"); 396 GURL url = NavigateToMockURL("b");
397 FilePath download_dir = DownloadPrefs::FromDownloadManager( 397 FilePath download_dir = DownloadPrefs::FromDownloadManager(
398 GetDownloadManager())->download_path(); 398 GetDownloadManager())->DownloadPath();
399 FilePath full_file_name = download_dir.AppendASCII(std::string( 399 FilePath full_file_name = download_dir.AppendASCII(std::string(
400 "Test page for saving page feature.mhtml")); 400 "Test page for saving page feature.mhtml"));
401 #if defined(OS_CHROMEOS) 401 #if defined(OS_CHROMEOS)
402 SavePackageFilePickerChromeOS::SetShouldPromptUser(false); 402 SavePackageFilePickerChromeOS::SetShouldPromptUser(false);
403 #else 403 #else
404 SavePackageFilePicker::SetShouldPromptUser(false); 404 SavePackageFilePicker::SetShouldPromptUser(false);
405 #endif 405 #endif
406 ui_test_utils::WindowedNotificationObserver observer( 406 ui_test_utils::WindowedNotificationObserver observer(
407 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, 407 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
408 content::NotificationService::AllSources()); 408 content::NotificationService::AllSources());
409 chrome::SavePage(browser()); 409 chrome::SavePage(browser());
410 observer.Wait(); 410 observer.Wait();
411 CheckDownloadHistory(url, full_file_name, -1); 411 CheckDownloadHistory(url, full_file_name, -1);
412 412
413 EXPECT_TRUE(file_util::PathExists(full_file_name)); 413 EXPECT_TRUE(file_util::PathExists(full_file_name));
414 int64 actual_file_size = -1; 414 int64 actual_file_size = -1;
415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
416 EXPECT_LE(kFileSizeMin, actual_file_size); 416 EXPECT_LE(kFileSizeMin, actual_file_size);
417 } 417 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_prefs.cc ('k') | chrome/browser/extensions/api/serial/serial_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698