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

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

Issue 23022006: Remove GetActiveEntry usage from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Save Page As code and test. Created 7 years, 3 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_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, 586 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest,
587 MAYBE_SaveDuringInitialNavigationIncognito) { 587 MAYBE_SaveDuringInitialNavigationIncognito) {
588 // Open an Incognito window. 588 // Open an Incognito window.
589 Browser* incognito = CreateIncognitoBrowser(); // Waits. 589 Browser* incognito = CreateIncognitoBrowser(); // Waits.
590 ASSERT_TRUE(incognito); 590 ASSERT_TRUE(incognito);
591 591
592 // Create a download item creation waiter on that window. 592 // Create a download item creation waiter on that window.
593 DownloadItemCreatedObserver creation_observer( 593 DownloadItemCreatedObserver creation_observer(
594 BrowserContext::GetDownloadManager(incognito->profile())); 594 BrowserContext::GetDownloadManager(incognito->profile()));
595 595
596 // The navigation needs to at least commit, otherwise there will be nothing
Charlie Reis 2013/09/16 23:10:54 I agree with rdsmith: this test appears to be a re
nasko 2013/09/18 17:03:18 Reverting this in favor of more complete fix as di
597 // to save. The test doesn't need to wait for a full page load though.
598 content::WindowedNotificationObserver commit_observer(
599 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
600 content::NotificationService::AllSources());
601
596 // Navigate, unblocking with new tab. 602 // Navigate, unblocking with new tab.
597 GURL url = URLRequestMockHTTPJob::GetMockUrl( 603 GURL url = URLRequestMockHTTPJob::GetMockUrl(
598 base::FilePath(kTestDir).AppendASCII("b.htm")); 604 base::FilePath(kTestDir).AppendASCII("b.htm"));
599 NavigateToURLWithDisposition(incognito, url, NEW_FOREGROUND_TAB, 605 NavigateToURLWithDisposition(incognito, url, NEW_FOREGROUND_TAB,
600 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 606 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
607 commit_observer.Wait();
601 608
602 // Save the page before completion. 609 // Save the page before completion.
603 base::FilePath full_file_name, dir; 610 base::FilePath full_file_name, dir;
604 GetDestinationPaths("b", &full_file_name, &dir); 611 GetDestinationPaths("b", &full_file_name, &dir);
605 scoped_refptr<content::MessageLoopRunner> loop_runner( 612 scoped_refptr<content::MessageLoopRunner> loop_runner(
606 new content::MessageLoopRunner); 613 new content::MessageLoopRunner);
607 SavePackageFinishedObserver observer( 614 SavePackageFinishedObserver observer(
608 content::BrowserContext::GetDownloadManager(incognito->profile()), 615 content::BrowserContext::GetDownloadManager(incognito->profile()),
609 loop_runner->QuitClosure()); 616 loop_runner->QuitClosure());
610 ASSERT_TRUE(GetCurrentTab(incognito)->SavePage( 617 ASSERT_TRUE(GetCurrentTab(incognito)->SavePage(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 GetDownloadManager())->DownloadPath(); 815 GetDownloadManager())->DownloadPath();
809 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); 816 base::FilePath filename = download_dir.AppendASCII("dataurl.txt");
810 ASSERT_TRUE(base::PathExists(filename)); 817 ASSERT_TRUE(base::PathExists(filename));
811 std::string contents; 818 std::string contents;
812 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); 819 EXPECT_TRUE(base::ReadFileToString(filename, &contents));
813 EXPECT_EQ("foo", contents); 820 EXPECT_EQ("foo", contents);
814 } 821 }
815 822
816 } // namespace 823 } // namespace
817 824
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/accessibility_ui.cc » ('j') | content/browser/accessibility/accessibility_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698