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

Unified Diff: webkit/tools/test_shell/image_decoder_unittest.cc

Issue 7974: Port a few test_shell_tests. Now it runs 45 of them.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/image_decoder_unittest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « webkit/tools/test_shell/image_decoder_unittest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698