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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/file_path.h" 6 #include "base/file_path.h"
7 #include "base/files/scoped_temp_dir.h"
7 #include "base/run_loop.h" 8 #include "base/run_loop.h"
8 #include "base/scoped_temp_dir.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/test/test_utils.h" 10 #include "content/public/test/test_utils.h"
11 #include "content/shell/shell.h" 11 #include "content/shell/shell.h"
12 #include "content/test/content_browser_test.h" 12 #include "content/test/content_browser_test.h"
13 #include "content/test/content_browser_test_utils.h" 13 #include "content/test/content_browser_test_utils.h"
14 #include "net/test/test_server.h" 14 #include "net/test/test_server.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class MHTMLGenerationTest : public ContentBrowserTest { 19 class MHTMLGenerationTest : public ContentBrowserTest {
20 public: 20 public:
21 MHTMLGenerationTest() : mhtml_generated_(false), file_size_(0) {} 21 MHTMLGenerationTest() : mhtml_generated_(false), file_size_(0) {}
22 22
23 void MHTMLGenerated(const FilePath& path, int64 size) { 23 void MHTMLGenerated(const FilePath& path, int64 size) {
24 mhtml_generated_ = true; 24 mhtml_generated_ = true;
25 file_size_ = size; 25 file_size_ = size;
26 MessageLoopForUI::current()->Quit(); 26 MessageLoopForUI::current()->Quit();
27 } 27 }
28 28
29 protected: 29 protected:
30 virtual void SetUp() { 30 virtual void SetUp() {
31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
32 ContentBrowserTest::SetUp(); 32 ContentBrowserTest::SetUp();
33 } 33 }
34 34
35 bool mhtml_generated() const { return mhtml_generated_; } 35 bool mhtml_generated() const { return mhtml_generated_; }
36 int64 file_size() const { return file_size_; } 36 int64 file_size() const { return file_size_; }
37 37
38 ScopedTempDir temp_dir_; 38 base::ScopedTempDir temp_dir_;
39 39
40 private: 40 private:
41 bool mhtml_generated_; 41 bool mhtml_generated_;
42 int64 file_size_; 42 int64 file_size_;
43 }; 43 };
44 44
45 // Tests that generating a MHTML does create contents. 45 // Tests that generating a MHTML does create contents.
46 // Note that the actual content of the file is not tested, the purpose of this 46 // Note that the actual content of the file is not tested, the purpose of this
47 // test is to ensure we were successfull in creating the MHTML data from the 47 // test is to ensure we were successfull in creating the MHTML data from the
48 // renderer. 48 // renderer.
(...skipping 14 matching lines...) Expand all
63 EXPECT_TRUE(mhtml_generated()); 63 EXPECT_TRUE(mhtml_generated());
64 EXPECT_GT(file_size(), 0); 64 EXPECT_GT(file_size(), 0);
65 65
66 // Make sure the actual generated file has some contents. 66 // Make sure the actual generated file has some contents.
67 int64 file_size; 67 int64 file_size;
68 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); 68 ASSERT_TRUE(file_util::GetFileSize(path, &file_size));
69 EXPECT_GT(file_size, 100); 69 EXPECT_GT(file_size, 100);
70 } 70 }
71 71
72 } // namespace content 72 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/file_metadata_unittest_linux.cc ('k') | content/browser/download/save_package_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698