summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 23:10:46 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 23:10:46 +0000
commit60aac62ddf3cc40741a824cae25ab190005513be (patch)
tree0f55441604d8e4ee3693d0ce6b3e8e8d4dbe06cc /chrome/test
parentda4e34b86c37f77dc7027fbc1fd599d319b69bd0 (diff)
downloadchromium_src-60aac62ddf3cc40741a824cae25ab190005513be.zip
chromium_src-60aac62ddf3cc40741a824cae25ab190005513be.tar.gz
chromium_src-60aac62ddf3cc40741a824cae25ab190005513be.tar.bz2
Un-duplicate EvictFileFromSystemCache.
Change required for http://codereview.chromium.org/9639 . Review URL: http://codereview.chromium.org/12407 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.scons1
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.vcproj4
-rw-r--r--chrome/test/interactive_ui/interactive_ui.vcproj4
-rw-r--r--chrome/test/interactive_ui/interactive_ui_tests.scons1
-rw-r--r--chrome/test/memory_test/memory_test.scons1
-rw-r--r--chrome/test/memory_test/memory_test.vcproj8
-rw-r--r--chrome/test/page_cycler/page_cycler_tests.scons1
-rw-r--r--chrome/test/page_cycler/page_cycler_tests.vcproj4
-rw-r--r--chrome/test/perf/perftests.scons1
-rw-r--r--chrome/test/perf/perftests.vcproj8
-rw-r--r--chrome/test/plugin/plugin_tests.scons1
-rw-r--r--chrome/test/plugin/plugin_tests.vcproj4
-rw-r--r--chrome/test/reliability/reliability_tests.scons1
-rw-r--r--chrome/test/reliability/reliability_tests.vcproj4
-rw-r--r--chrome/test/selenium/selenium_tests.scons1
-rw-r--r--chrome/test/selenium/selenium_tests.vcproj4
-rw-r--r--chrome/test/startup/startup_tests.scons1
-rw-r--r--chrome/test/startup/startup_tests.vcproj8
-rw-r--r--chrome/test/tab_switching/tab_switching.vcproj4
-rw-r--r--chrome/test/tab_switching/tab_switching_test.scons1
-rw-r--r--chrome/test/test_file_util.cc100
-rw-r--r--chrome/test/test_file_util.h31
-rw-r--r--chrome/test/ui/ui_tests.scons1
-rw-r--r--chrome/test/ui/ui_tests.vcproj4
24 files changed, 0 insertions, 198 deletions
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.scons b/chrome/test/automated_ui_tests/automated_ui_tests.scons
index 659d398..93d1774 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.scons
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.scons
@@ -66,7 +66,6 @@ if env['PLATFORM'] == 'win32':
input_files = [
'automated_ui_tests.cc',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'$CHROME_DIR/test/perf/mem_usage$OBJSUFFIX',
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.vcproj b/chrome/test/automated_ui_tests/automated_ui_tests.vcproj
index 71914d1..23188fc 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.vcproj
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.vcproj
@@ -162,10 +162,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/interactive_ui/interactive_ui.vcproj b/chrome/test/interactive_ui/interactive_ui.vcproj
index 4d96759..a4863ee 100644
--- a/chrome/test/interactive_ui/interactive_ui.vcproj
+++ b/chrome/test/interactive_ui/interactive_ui.vcproj
@@ -171,10 +171,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_profile.cc"
>
</File>
diff --git a/chrome/test/interactive_ui/interactive_ui_tests.scons b/chrome/test/interactive_ui/interactive_ui_tests.scons
index e60de9a..eda7f26 100644
--- a/chrome/test/interactive_ui/interactive_ui_tests.scons
+++ b/chrome/test/interactive_ui/interactive_ui_tests.scons
@@ -95,7 +95,6 @@ input_files = [
'$CHROME_DIR/browser/views/constrained_window_impl_interactive_uitest.cc',
'$CHROME_DIR/browser/views/tabs/tab_dragging_test.cc',
'$CHROME_DIR/test/interactive_ui/npapi_interactive_test.cc',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'$CHROME_DIR/test/testing_profile$OBJSUFFIX',
'$CHROME_DIR/test/ui/npapi_test_helper$OBJSUFFIX',
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
diff --git a/chrome/test/memory_test/memory_test.scons b/chrome/test/memory_test/memory_test.scons
index f3b350d..af86998 100644
--- a/chrome/test/memory_test/memory_test.scons
+++ b/chrome/test/memory_test/memory_test.scons
@@ -59,7 +59,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'memory_test.cc',
]
diff --git a/chrome/test/memory_test/memory_test.vcproj b/chrome/test/memory_test/memory_test.vcproj
index 75efd21..d34f420 100644
--- a/chrome/test/memory_test/memory_test.vcproj
+++ b/chrome/test/memory_test/memory_test.vcproj
@@ -164,14 +164,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
- RelativePath="..\test_file_util.h"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/page_cycler/page_cycler_tests.scons b/chrome/test/page_cycler/page_cycler_tests.scons
index 78f26ae..dfb8cb8 100644
--- a/chrome/test/page_cycler/page_cycler_tests.scons
+++ b/chrome/test/page_cycler/page_cycler_tests.scons
@@ -65,7 +65,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'page_cycler_test.cc',
]
diff --git a/chrome/test/page_cycler/page_cycler_tests.vcproj b/chrome/test/page_cycler/page_cycler_tests.vcproj
index a3a7025..d3a7717 100644
--- a/chrome/test/page_cycler/page_cycler_tests.vcproj
+++ b/chrome/test/page_cycler/page_cycler_tests.vcproj
@@ -164,10 +164,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/perf/perftests.scons b/chrome/test/perf/perftests.scons
index 2a75ef2..d93f4a6 100644
--- a/chrome/test/perf/perftests.scons
+++ b/chrome/test/perf/perftests.scons
@@ -69,7 +69,6 @@ input_files = [
'$CHROME_DIR/browser/visitedlink_master$OBJSUFFIX',
'$CHROME_DIR/browser/visitedlink_perftest.cc',
'$CHROME_DIR/common/json_value_serializer_perftest.cc',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
]
env.ChromeTestProgram('perf_tests', input_files)
diff --git a/chrome/test/perf/perftests.vcproj b/chrome/test/perf/perftests.vcproj
index 44435d5..89cbba1 100644
--- a/chrome/test/perf/perftests.vcproj
+++ b/chrome/test/perf/perftests.vcproj
@@ -168,14 +168,6 @@
RelativePath="..\..\..\base\perftimer.cc"
>
</File>
- <File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
- RelativePath="..\test_file_util.h"
- >
- </File>
</Filter>
<Filter
Name="TestURLParser"
diff --git a/chrome/test/plugin/plugin_tests.scons b/chrome/test/plugin/plugin_tests.scons
index 677f72d..da7e348 100644
--- a/chrome/test/plugin/plugin_tests.scons
+++ b/chrome/test/plugin/plugin_tests.scons
@@ -67,7 +67,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'plugin_test.cpp',
]
diff --git a/chrome/test/plugin/plugin_tests.vcproj b/chrome/test/plugin/plugin_tests.vcproj
index f8fca50..9c2fa00 100644
--- a/chrome/test/plugin/plugin_tests.vcproj
+++ b/chrome/test/plugin/plugin_tests.vcproj
@@ -165,10 +165,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/reliability/reliability_tests.scons b/chrome/test/reliability/reliability_tests.scons
index 27ff310..4b14f6d 100644
--- a/chrome/test/reliability/reliability_tests.scons
+++ b/chrome/test/reliability/reliability_tests.scons
@@ -66,7 +66,6 @@ input_files = [
'$CHROME_DIR/test/perf/mem_usage$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'page_load_test.cc',
'run_all_unittests.cc',
]
diff --git a/chrome/test/reliability/reliability_tests.vcproj b/chrome/test/reliability/reliability_tests.vcproj
index 04f0ef9..1e443a7f 100644
--- a/chrome/test/reliability/reliability_tests.vcproj
+++ b/chrome/test/reliability/reliability_tests.vcproj
@@ -168,10 +168,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/selenium/selenium_tests.scons b/chrome/test/selenium/selenium_tests.scons
index 23259ee..b359940 100644
--- a/chrome/test/selenium/selenium_tests.scons
+++ b/chrome/test/selenium/selenium_tests.scons
@@ -69,7 +69,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'selenium_test.cc',
]
diff --git a/chrome/test/selenium/selenium_tests.vcproj b/chrome/test/selenium/selenium_tests.vcproj
index 572819c..727dfa0 100644
--- a/chrome/test/selenium/selenium_tests.vcproj
+++ b/chrome/test/selenium/selenium_tests.vcproj
@@ -164,10 +164,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/startup/startup_tests.scons b/chrome/test/startup/startup_tests.scons
index 88be476..f857656 100644
--- a/chrome/test/startup/startup_tests.scons
+++ b/chrome/test/startup/startup_tests.scons
@@ -63,7 +63,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'feature_startup_test.cc',
'startup_test.cc',
]
diff --git a/chrome/test/startup/startup_tests.vcproj b/chrome/test/startup/startup_tests.vcproj
index e7f38a2..1ebb980 100644
--- a/chrome/test/startup/startup_tests.vcproj
+++ b/chrome/test/startup/startup_tests.vcproj
@@ -164,14 +164,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
- RelativePath="..\test_file_util.h"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/tab_switching/tab_switching.vcproj b/chrome/test/tab_switching/tab_switching.vcproj
index d9a9b03..bdc2836 100644
--- a/chrome/test/tab_switching/tab_switching.vcproj
+++ b/chrome/test/tab_switching/tab_switching.vcproj
@@ -164,10 +164,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>
diff --git a/chrome/test/tab_switching/tab_switching_test.scons b/chrome/test/tab_switching/tab_switching_test.scons
index 0856f50..d1932db 100644
--- a/chrome/test/tab_switching/tab_switching_test.scons
+++ b/chrome/test/tab_switching/tab_switching_test.scons
@@ -64,7 +64,6 @@ input_files = [
'$CHROME_DIR/test/ui/run_all_unittests$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test$OBJSUFFIX',
'$CHROME_DIR/test/ui/ui_test_suite$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'tab_switching_test.cc',
]
diff --git a/chrome/test/test_file_util.cc b/chrome/test/test_file_util.cc
index 5bb55cc..e69de29 100644
--- a/chrome/test/test_file_util.cc
+++ b/chrome/test/test_file_util.cc
@@ -1,100 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <vector>
-#include <windows.h>
-
-#include "chrome/test/test_file_util.h"
-
-#include "base/file_util.h"
-#include "chrome/common/win_util.h"
-
-namespace file_util {
-
-bool EvictFileFromSystemCache(const wchar_t* file) {
- // Request exclusive access to the file and overwrite it with no buffering.
- win_util::ScopedHandle hfile(
- CreateFile(file, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- OPEN_EXISTING, FILE_FLAG_NO_BUFFERING,
- NULL));
- if (!hfile)
- return false;
-
- // Execute in chunks. It could be optimized. We want to do few of these since
- // these opterations will be slow without the cache.
- char buffer[4096];
- int total_bytes = 0;
- DWORD bytes_read;
- for (;;) {
- bytes_read = 0;
- ReadFile(hfile, buffer, sizeof(buffer), &bytes_read, NULL);
- if (bytes_read == 0)
- break;
-
- SetFilePointer(hfile, total_bytes, 0, FILE_BEGIN);
- if (!WriteFile(hfile, buffer, bytes_read, &bytes_read, NULL))
- return false;
- total_bytes += bytes_read;
- }
- return true;
-}
-
-// Like CopyFileNoCache but recursively copies all files and subdirectories
-// in the given input directory to the output directory.
-bool CopyRecursiveDirNoCache(const std::wstring& source_dir,
- const std::wstring& dest_dir) {
- // Try to create the directory if it doesn't already exist.
- if (!CreateDirectory(dest_dir)) {
- if (GetLastError() != ERROR_ALREADY_EXISTS)
- return false;
- }
-
- std::vector<std::wstring> files_copied;
-
- std::wstring src(source_dir);
- file_util::AppendToPath(&src, L"*");
-
- WIN32_FIND_DATA fd;
- HANDLE fh = FindFirstFile(src.c_str(), &fd);
- if (fh == INVALID_HANDLE_VALUE)
- return false;
-
- do {
- std::wstring cur_file(fd.cFileName);
- if (cur_file == L"." || cur_file == L"..")
- continue; // Skip these special entries.
-
- std::wstring cur_source_path(source_dir);
- file_util::AppendToPath(&cur_source_path, cur_file);
-
- std::wstring cur_dest_path(dest_dir);
- file_util::AppendToPath(&cur_dest_path, cur_file);
-
- if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- // Recursively copy a subdirectory. We stripped "." and ".." already.
- if (!CopyRecursiveDirNoCache(cur_source_path, cur_dest_path)) {
- FindClose(fh);
- return false;
- }
- } else {
- // Copy the file.
- if (!::CopyFile(cur_source_path.c_str(), cur_dest_path.c_str(), false)) {
- FindClose(fh);
- return false;
- }
-
- // We don't check for errors from this function, often, we are copying
- // files that are in the repository, and they will have read-only set.
- // This will prevent us from evicting from the cache, but these don't
- // matter anyway.
- EvictFileFromSystemCache(cur_dest_path.c_str());
- }
- } while (FindNextFile(fh, &fd));
-
- FindClose(fh);
- return true;
-}
-
-} // namespace file_util
-
diff --git a/chrome/test/test_file_util.h b/chrome/test/test_file_util.h
index dd4e34f..e69de29 100644
--- a/chrome/test/test_file_util.h
+++ b/chrome/test/test_file_util.h
@@ -1,31 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_TEST_TEST_FILE_UTIL_H__
-#define CHROME_TEST_TEST_FILE_UTIL_H__
-
-// File utility functions used only by tests.
-
-#include <string>
-
-namespace file_util {
-
-// Clear a specific file from the system cache using a neat trick. After this
-// call, trying to access this file will result in a cold load from the hard
-// drive.
-bool EvictFileFromSystemCache(const wchar_t* file);
-
-// Like CopyFileNoCache but recursively copies all files and subdirectories
-// in the given input directory to the output directory. Any files in the
-// destination that already exist will be overwritten.
-//
-// Returns true on success. False means there was some error copying, so the
-// state of the destination is unknown.
-bool CopyRecursiveDirNoCache(const std::wstring& source_dir,
- const std::wstring& dest_dir);
-
-} // namespace file_util
-
-#endif // CHROME_TEST_TEST_FILE_UTIL_H__
-
diff --git a/chrome/test/ui/ui_tests.scons b/chrome/test/ui/ui_tests.scons
index b83e5b5..597e438 100644
--- a/chrome/test/ui/ui_tests.scons
+++ b/chrome/test/ui/ui_tests.scons
@@ -120,7 +120,6 @@ ui_test_files = [
'$CHROME_DIR/test/automation/automation_proxy_uitest.cc',
'$CHROME_DIR/test/perf/mem_usage.cc',
'$CHROME_DIR/test/reliability/page_load_test$OBJSUFFIX',
- '$CHROME_DIR/test/test_file_util$OBJSUFFIX',
'$NET_DIR/url_request/url_request_test_job$OBJSUFFIX',
]
diff --git a/chrome/test/ui/ui_tests.vcproj b/chrome/test/ui/ui_tests.vcproj
index 067b232..a6f8395 100644
--- a/chrome/test/ui/ui_tests.vcproj
+++ b/chrome/test/ui/ui_tests.vcproj
@@ -174,10 +174,6 @@
>
</File>
<File
- RelativePath="..\test_file_util.cc"
- >
- </File>
- <File
RelativePath="..\testing_browser_process.h"
>
</File>