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

Side by Side Diff: content/browser/download/save_package_browsertest.cc

Issue 2316043002: //content: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 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
OLDNEW
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/files/scoped_temp_dir.h" 5 #include "base/files/scoped_temp_dir.h"
6 #include "content/browser/download/save_package.h" 6 #include "content/browser/download/save_package.h"
7 #include "content/public/test/content_browser_test.h" 7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h" 8 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/shell/browser/shell.h" 9 #include "content/shell/browser/shell.h"
10 #include "net/test/embedded_test_server/embedded_test_server.h" 10 #include "net/test/embedded_test_server/embedded_test_server.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 const char kTestFile[] = "/simple_page.html"; 14 const char kTestFile[] = "/simple_page.html";
15 15
16 class SavePackageBrowserTest : public ContentBrowserTest { 16 class SavePackageBrowserTest : public ContentBrowserTest {
17 protected: 17 protected:
18 void SetUp() override { 18 void SetUp() override {
19 ASSERT_TRUE(save_dir_.CreateUniqueTempDir()); 19 ASSERT_TRUE(save_dir_.CreateUniqueTempDir());
20 ContentBrowserTest::SetUp(); 20 ContentBrowserTest::SetUp();
21 } 21 }
22 22
23 // Returns full paths of destination file and directory. 23 // Returns full paths of destination file and directory.
24 void GetDestinationPaths(const std::string& prefix, 24 void GetDestinationPaths(const std::string& prefix,
25 base::FilePath* full_file_name, 25 base::FilePath* full_file_name,
26 base::FilePath* dir) { 26 base::FilePath* dir) {
27 *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm"); 27 *full_file_name = save_dir_.GetPath().AppendASCII(prefix + ".htm");
28 *dir = save_dir_.path().AppendASCII(prefix + "_files"); 28 *dir = save_dir_.GetPath().AppendASCII(prefix + "_files");
29 } 29 }
30 30
31 // Temporary directory we will save pages to. 31 // Temporary directory we will save pages to.
32 base::ScopedTempDir save_dir_; 32 base::ScopedTempDir save_dir_;
33 }; 33 };
34 34
35 // Create a SavePackage and delete it without calling Init. 35 // Create a SavePackage and delete it without calling Init.
36 // SavePackage dtor has various asserts/checks that should not fire. 36 // SavePackage dtor has various asserts/checks that should not fire.
37 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ImplicitCancel) { 37 IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ImplicitCancel) {
38 ASSERT_TRUE(embedded_test_server()->Start()); 38 ASSERT_TRUE(embedded_test_server()->Start());
(...skipping 14 matching lines...) Expand all
53 NavigateToURL(shell(), url); 53 NavigateToURL(shell(), url);
54 base::FilePath full_file_name, dir; 54 base::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 shell()->web_contents(), SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name, 57 shell()->web_contents(), SAVE_PAGE_TYPE_AS_ONLY_HTML, full_file_name,
58 dir)); 58 dir));
59 save_package->Cancel(true); 59 save_package->Cancel(true);
60 } 60 }
61 61
62 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/mhtml_generation_browsertest.cc ('k') | content/browser/download/save_package_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698