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

Side by Side Diff: chrome/browser/parsers/metadata_parser_filebase_unittest.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/string_util.h" // TODO(brettw) remove when WideToASCII moves. 11 #include "base/string_util.h" // TODO(brettw) remove when base::WideToASCII mov es.
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "chrome/browser/parsers/metadata_parser_filebase.h" 13 #include "chrome/browser/parsers/metadata_parser_filebase.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace { 16 namespace {
17 17
18 class FileMetaDataParserTest : public testing::Test { 18 class FileMetaDataParserTest : public testing::Test {
19 protected: 19 protected:
20 virtual void SetUp() { 20 virtual void SetUp() {
21 // 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.
22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 22 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
23 23
24 test_file_ = temp_dir_.path().AppendASCII("FileMetaDataParserTest"); 24 test_file_ = temp_dir_.path().AppendASCII("FileMetaDataParserTest");
25 25
26 // Create the test file. 26 // Create the test file.
27 std::string content = "content"; 27 std::string content = "content";
28 int write_size = file_util::WriteFile(test_file_, content.c_str(), 28 int write_size = file_util::WriteFile(test_file_, content.c_str(),
29 content.length()); 29 content.length());
30 ASSERT_EQ(static_cast<int>(content.length()), write_size); 30 ASSERT_EQ(static_cast<int>(content.length()), write_size);
31 } 31 }
32 32
33 std::string test_file_str() { 33 std::string test_file_str() {
34 #if defined(OS_POSIX) 34 #if defined(OS_POSIX)
35 return test_file_.BaseName().value(); 35 return test_file_.BaseName().value();
36 #elif defined(OS_WIN) 36 #elif defined(OS_WIN)
37 return WideToASCII(test_file_.BaseName().value()); 37 return base::WideToASCII(test_file_.BaseName().value());
38 #endif // defined(OS_POSIX) 38 #endif // defined(OS_POSIX)
39 } 39 }
40 40
41 std::string test_file_size() { 41 std::string test_file_size() {
42 int64 size; 42 int64 size;
43 EXPECT_TRUE(file_util::GetFileSize(test_file_, &size)); 43 EXPECT_TRUE(file_util::GetFileSize(test_file_, &size));
44 44
45 return base::Int64ToString(size); 45 return base::Int64ToString(size);
46 } 46 }
47 47
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 expectations.erase(key); 91 expectations.erase(key);
92 } 92 }
93 93
94 EXPECT_TRUE(iter->IsEnd()); 94 EXPECT_TRUE(iter->IsEnd());
95 EXPECT_FALSE(iter->GetNext(&key, &value)); 95 EXPECT_FALSE(iter->GetNext(&key, &value));
96 EXPECT_TRUE(expectations.empty()); 96 EXPECT_TRUE(expectations.empty());
97 } 97 }
98 98
99 } // namespace 99 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/parsers/metadata_parser_filebase.cc ('k') | chrome/browser/parsers/metadata_parser_jpeg_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698