OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/scoped_temp_dir.h" | 5 #include "base/scoped_temp_dir.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/test/base/in_process_browser_test.h" | 7 #include "chrome/test/base/in_process_browser_test.h" |
8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
9 #include "content/browser/download/save_package.h" | 9 #include "content/browser/download/save_package.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Create a SavePackage and delete it without calling Init. | 34 // Create a SavePackage and delete it without calling Init. |
35 // SavePackage dtor has various asserts/checks that should not fire. | 35 // SavePackage dtor has various asserts/checks that should not fire. |
36 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ImplicitCancel) { | 36 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ImplicitCancel) { |
37 ASSERT_TRUE(test_server()->Start()); | 37 ASSERT_TRUE(test_server()->Start()); |
38 GURL url = test_server()->GetURL(kTestFile); | 38 GURL url = test_server()->GetURL(kTestFile); |
39 ui_test_utils::NavigateToURL(browser(), url); | 39 ui_test_utils::NavigateToURL(browser(), url); |
40 FilePath full_file_name, dir; | 40 FilePath full_file_name, dir; |
41 GetDestinationPaths("a", &full_file_name, &dir); | 41 GetDestinationPaths("a", &full_file_name, &dir); |
42 scoped_refptr<SavePackage> save_package(new SavePackage( | 42 scoped_refptr<SavePackage> save_package(new SavePackage( |
43 browser()->GetSelectedWebContents(), | 43 browser()->GetActiveWebContents(), |
44 content::SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); | 44 content::SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); |
45 ASSERT_TRUE(test_server()->Stop()); | 45 ASSERT_TRUE(test_server()->Stop()); |
46 } | 46 } |
47 | 47 |
48 // Create a SavePackage, call Cancel, then delete it. | 48 // Create a SavePackage, call Cancel, then delete it. |
49 // SavePackage dtor has various asserts/checks that should not fire. | 49 // SavePackage dtor has various asserts/checks that should not fire. |
50 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ExplicitCancel) { | 50 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ExplicitCancel) { |
51 ASSERT_TRUE(test_server()->Start()); | 51 ASSERT_TRUE(test_server()->Start()); |
52 GURL url = test_server()->GetURL(kTestFile); | 52 GURL url = test_server()->GetURL(kTestFile); |
53 ui_test_utils::NavigateToURL(browser(), url); | 53 ui_test_utils::NavigateToURL(browser(), url); |
54 FilePath full_file_name, dir; | 54 FilePath full_file_name, dir; |
55 GetDestinationPaths("a", &full_file_name, &dir); | 55 GetDestinationPaths("a", &full_file_name, &dir); |
56 scoped_refptr<SavePackage> save_package(new SavePackage( | 56 scoped_refptr<SavePackage> save_package(new SavePackage( |
57 browser()->GetSelectedWebContents(), | 57 browser()->GetActiveWebContents(), |
58 content::SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); | 58 content::SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, dir)); |
59 save_package->Cancel(true); | 59 save_package->Cancel(true); |
60 ASSERT_TRUE(test_server()->Stop()); | 60 ASSERT_TRUE(test_server()->Stop()); |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
OLD | NEW |