Index: webkit/tools/test_shell/image_decoder_unittest.cc |
=================================================================== |
--- webkit/tools/test_shell/image_decoder_unittest.cc (revision 3977) |
+++ webkit/tools/test_shell/image_decoder_unittest.cc (working copy) |
@@ -4,15 +4,14 @@ |
#include "config.h" |
-#include <windows.h> |
+#include "webkit/tools/test_shell/image_decoder_unittest.h" |
#include "base/file_util.h" |
#include "base/md5.h" |
#include "base/path_service.h" |
-#include "base/scoped_handle.h" |
#include "base/scoped_ptr.h" |
+#include "base/string_util.h" |
#include "base/time.h" |
-#include "webkit/tools/test_shell/image_decoder_unittest.h" |
void ReadFileToVector(const std::wstring& path, Vector<char>* contents) { |
std::string contents_str; |
@@ -42,9 +41,7 @@ |
&digest); |
// Write sum to disk. |
- DWORD bytes_written; |
- ASSERT_TRUE(WriteFile(handle, &digest, sizeof digest, &bytes_written, |
- NULL)); |
+ int bytes_written = file_util::WriteFile(path, &digest, sizeof digest); |
ASSERT_EQ(sizeof digest, bytes_written); |
} |
#else |
@@ -87,19 +84,21 @@ |
} |
std::vector<std::wstring> ImageDecoderTest::GetImageFiles() const { |
- std::wstring find_string(data_dir_); |
- file_util::AppendToPath(&find_string, L"*." + format_); |
- WIN32_FIND_DATA find_data; |
- ScopedFindFileHandle handle(FindFirstFile(find_string.c_str(), |
- &find_data)); |
- EXPECT_TRUE(handle.IsValid()); |
+ std::wstring pattern = L"*." + format_; |
+ file_util::FileEnumerator enumerator(data_dir_, false, |
+ file_util::FileEnumerator::FILES); |
+ |
std::vector<std::wstring> image_files; |
- do { |
+ std::wstring next_file_name; |
+ while ((next_file_name = enumerator.Next()) != L"") { |
+ if (!MatchPattern(next_file_name, pattern)) { |
+ continue; |
+ } |
std::wstring image_path = data_dir_; |
- file_util::AppendToPath(&image_path, find_data.cFileName); |
+ file_util::AppendToPath(&image_path, next_file_name); |
image_files.push_back(image_path); |
- } while (FindNextFile(handle, &find_data)); |
+ } |
return image_files; |
} |