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

Side by Side Diff: chrome/common/zip_reader_unittest.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
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/zip_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/zip_reader.h" 5 #include "chrome/common/zip_reader.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
11 #endif 11 #endif
12 12
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 15
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/files/scoped_temp_dir.h"
17 #include "base/md5.h" 18 #include "base/md5.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/scoped_temp_dir.h"
20 #include "base/time.h" 20 #include "base/time.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/zip_internal.h" 23 #include "chrome/common/zip_internal.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "testing/platform_test.h" 25 #include "testing/platform_test.h"
26 26
27 namespace { 27 namespace {
28 28
29 #if defined(OS_POSIX) 29 #if defined(OS_POSIX)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // The path to test.zip in the test data directory. 105 // The path to test.zip in the test data directory.
106 FilePath test_zip_file_; 106 FilePath test_zip_file_;
107 // The path to evil.zip in the test data directory. 107 // The path to evil.zip in the test data directory.
108 FilePath evil_zip_file_; 108 FilePath evil_zip_file_;
109 // The path to evil_via_invalid_utf8.zip in the test data directory. 109 // The path to evil_via_invalid_utf8.zip in the test data directory.
110 FilePath evil_via_invalid_utf8_zip_file_; 110 FilePath evil_via_invalid_utf8_zip_file_;
111 // The path to evil_via_absolute_file_name.zip in the test data directory. 111 // The path to evil_via_absolute_file_name.zip in the test data directory.
112 FilePath evil_via_absolute_file_name_zip_file_; 112 FilePath evil_via_absolute_file_name_zip_file_;
113 std::set<FilePath> test_zip_contents_; 113 std::set<FilePath> test_zip_contents_;
114 114
115 ScopedTempDir temp_dir_; 115 base::ScopedTempDir temp_dir_;
116 }; 116 };
117 117
118 TEST_F(ZipReaderTest, Open_ValidZipFile) { 118 TEST_F(ZipReaderTest, Open_ValidZipFile) {
119 ZipReader reader; 119 ZipReader reader;
120 ASSERT_TRUE(reader.Open(test_zip_file_)); 120 ASSERT_TRUE(reader.Open(test_zip_file_));
121 } 121 }
122 122
123 #if defined(OS_POSIX) 123 #if defined(OS_POSIX)
124 TEST_F(ZipReaderTest, Open_ValidZipFd) { 124 TEST_F(ZipReaderTest, Open_ValidZipFd) {
125 ZipReader reader; 125 ZipReader reader;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 ASSERT_TRUE(reader.ExtractCurrentEntryToFilePath( 407 ASSERT_TRUE(reader.ExtractCurrentEntryToFilePath(
408 test_dir_.AppendASCII("test.txt"))); 408 test_dir_.AppendASCII("test.txt")));
409 409
410 std::string actual; 410 std::string actual;
411 ASSERT_TRUE(file_util::ReadFileToString( 411 ASSERT_TRUE(file_util::ReadFileToString(
412 test_dir_.AppendASCII("test.txt"), &actual)); 412 test_dir_.AppendASCII("test.txt"), &actual));
413 EXPECT_EQ(std::string("This is a test.\n"), actual); 413 EXPECT_EQ(std::string("This is a test.\n"), actual);
414 } 414 }
415 415
416 } // namespace zip 416 } // namespace zip
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/zip_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698