| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_util.h" // TODO(brettw) remove when WideToASCII moves. |
| 12 #include "chrome/browser/parsers/metadata_parser_filebase.h" | 13 #include "chrome/browser/parsers/metadata_parser_filebase.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class FileMetaDataParserTest : public testing::Test { | 18 class FileMetaDataParserTest : public testing::Test { |
| 18 protected: | 19 protected: |
| 19 virtual void SetUp() { | 20 virtual void SetUp() { |
| 20 // Create a temporary directory for testing and fill it with a file. | 21 // Create a temporary directory for testing and fill it with a file. |
| 21 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 return test_file_.BaseName().value(); | 35 return test_file_.BaseName().value(); |
| 35 #elif defined(OS_WIN) | 36 #elif defined(OS_WIN) |
| 36 return WideToASCII(test_file_.BaseName().value()); | 37 return WideToASCII(test_file_.BaseName().value()); |
| 37 #endif // defined(OS_POSIX) | 38 #endif // defined(OS_POSIX) |
| 38 } | 39 } |
| 39 | 40 |
| 40 std::string test_file_size() { | 41 std::string test_file_size() { |
| 41 int64 size; | 42 int64 size; |
| 42 EXPECT_TRUE(file_util::GetFileSize(test_file_, &size)); | 43 EXPECT_TRUE(file_util::GetFileSize(test_file_, &size)); |
| 43 | 44 |
| 44 return Int64ToString(size); | 45 return base::Int64ToString(size); |
| 45 } | 46 } |
| 46 | 47 |
| 47 ScopedTempDir temp_dir_; | 48 ScopedTempDir temp_dir_; |
| 48 FilePath test_file_; | 49 FilePath test_file_; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 TEST_F(FileMetaDataParserTest, Parse) { | 52 TEST_F(FileMetaDataParserTest, Parse) { |
| 52 FileMetadataParser parser(test_file_); | 53 FileMetadataParser parser(test_file_); |
| 53 | 54 |
| 54 EXPECT_TRUE(parser.Parse()); | 55 EXPECT_TRUE(parser.Parse()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 expectations.erase(key); | 91 expectations.erase(key); |
| 91 } | 92 } |
| 92 | 93 |
| 93 EXPECT_TRUE(iter->IsEnd()); | 94 EXPECT_TRUE(iter->IsEnd()); |
| 94 EXPECT_FALSE(iter->GetNext(&key, &value)); | 95 EXPECT_FALSE(iter->GetNext(&key, &value)); |
| 95 EXPECT_TRUE(expectations.empty()); | 96 EXPECT_TRUE(expectations.empty()); |
| 96 } | 97 } |
| 97 | 98 |
| 98 } // namespace | 99 } // namespace |
| OLD | NEW |