summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/logging.cc41
-rw-r--r--webkit/glue/webframe_impl.cc7
-rw-r--r--webkit/tools/test_shell/SConscript2
-rw-r--r--webkit/tools/test_shell/run_all_tests.cc4
-rw-r--r--webkit/tools/test_shell/test_shell.cc21
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc8
6 files changed, 54 insertions, 29 deletions
diff --git a/base/logging.cc b/base/logging.cc
index 98b2619..3a6f928 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -36,13 +36,10 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/command_line.h"
#include "base/debug_util.h"
#include "base/lock_impl.h"
-#include "base/platform_thread.h"
-#include "base/process_util.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
-#include "base/time.h"
-
+
namespace logging {
bool g_enable_dcheck = false;
@@ -109,6 +106,36 @@ pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
// Helper functions to wrap platform differences.
+int32 CurrentProcessId() {
+#if defined(OS_WIN)
+ return GetCurrentProcessId();
+#elif defined(OS_POSIX)
+ return getpid();
+#endif
+}
+
+int32 CurrentThreadId() {
+#if defined(OS_WIN)
+ return GetCurrentThreadId();
+#elif defined(OS_MACOSX)
+ return mach_thread_self();
+#else
+ NOTIMPLEMENTED();
+ return 0;
+#endif
+}
+
+uint64 TickCount() {
+#if defined(OS_WIN)
+ return GetTickCount();
+#elif defined(OS_MACOSX)
+ return mach_absolute_time();
+#else
+ NOTIMPLEMENTED();
+ return 0;
+#endif
+}
+
void CloseFile(FileHandle log) {
#if defined(OS_WIN)
CloseHandle(log);
@@ -335,9 +362,9 @@ void LogMessage::Init(const char* file, int line) {
stream_ << '[';
if (log_process_id)
- stream_ << process_util::GetCurrentProcId() << ':';
+ stream_ << CurrentProcessId() << ':';
if (log_thread_id)
- stream_ << PlatformThread::CurrentId() << ':';
+ stream_ << CurrentThreadId() << ':';
if (log_timestamp) {
time_t t = time(NULL);
#if _MSC_VER >= 1400
@@ -357,7 +384,7 @@ void LogMessage::Init(const char* file, int line) {
<< ':';
}
if (log_tickcount)
- stream_ << base::TimeTicks::Now().ToInternalValue() << ':';
+ stream_ << TickCount() << ':';
stream_ << log_severity_names[severity_] << ":" << file << "(" << line << ")] ";
message_start_ = stream_.tellp();
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 6c1c897..a84a104 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -125,7 +125,6 @@ MSVC_PUSH_WARNING_LEVEL(0);
MSVC_POP_WARNING();
#undef LOG
-#include "base/basictypes.h"
#include "base/gfx/bitmap_platform_device.h"
#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
@@ -224,7 +223,7 @@ static void FrameContentAsPlainText(int max_chars, Frame* frame,
// size and also copy the results directly into a wstring, avoiding the
// string conversion.
for (TextIterator it(range.get()); !it.atEnd(); it.advance()) {
- const uint16* chars = reinterpret_cast<const uint16*>(it.characters());
+ const wchar_t* chars = reinterpret_cast<const wchar_t*>(it.characters());
if (!chars) {
if (it.length() != 0) {
// It appears from crash reports that an iterator can get into a state
@@ -247,9 +246,7 @@ static void FrameContentAsPlainText(int max_chars, Frame* frame,
}
int to_append = std::min(it.length(),
max_chars - static_cast<int>(output->size()));
- std::wstring wstr;
- UTF16ToWide(reinterpret_cast<const char16*>(chars), to_append, &wstr);
- output->append(wstr.c_str(), to_append);
+ output->append(chars, to_append);
if (output->size() >= static_cast<size_t>(max_chars))
return; // Filled up the buffer.
}
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index 63c3359..b591b8a 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -165,7 +165,6 @@ test_files = [
'$WEBKIT_DIR/glue/multipart_response_delegate_unittest.cc',
'$WEBKIT_DIR/glue/password_autocomplete_listener_unittest.cc',
'$WEBKIT_DIR/glue/regular_expression_unittest.cc',
- '$WEBKIT_DIR/glue/webframe_unittest.cc',
'$WEBKIT_DIR/port/platform/GKURL_unittest.cpp',
'$V8_DIR/snapshot-empty$OBJSUFFIX',
]
@@ -185,6 +184,7 @@ if env['PLATFORM'] == 'win32':
'$WEBKIT_DIR/glue/resource_fetcher_unittest.cc',
# Commented out until a regression is fixed and this file is restored.
#'$WEBKIT_DIR/glue/stringimpl_unittest.cc',
+ '$WEBKIT_DIR/glue/webframe_unittest.cc',
'$WEBKIT_DIR/glue/webplugin_impl_unittest.cc',
'$WEBKIT_DIR/port/platform/image-decoders/bmp/BMPImageDecoder_unittest.cpp',
'$WEBKIT_DIR/port/platform/image-decoders/ico/ICOImageDecoder_unittest.cpp',
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc
index 9a7f55b..60de050 100644
--- a/webkit/tools/test_shell/run_all_tests.cc
+++ b/webkit/tools/test_shell/run_all_tests.cc
@@ -47,9 +47,9 @@ int main(int argc, char* argv[]) {
CommandLine::SetArgcArgv(argc, argv);
#endif
+#if defined(OS_WIN)
TestShell::InitLogging(true, false); // suppress error dialogs
-#if defined(OS_WIN)
// Some of the individual tests wind up calling TestShell::WaitTestFinished
// which has a timeout in it. For these tests, we don't care about a timeout
// so just set it to be a really large number. This is necessary because
@@ -80,8 +80,10 @@ int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
+#if defined(OS_WIN)
TestShell::ShutdownTestShell();
TestShell::CleanupLogging();
+#endif
return result;
}
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 43e143f..8fac9aa 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -29,7 +29,6 @@
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/webwidget.h"
-#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "webkit_strings.h"
@@ -99,6 +98,7 @@ TestShell::TestShell()
url_util::AddStandardScheme("test-shell-resource");
}
+
TestShell::~TestShell() {
// Call GC twice to clean up garbage.
CallJSGC();
@@ -124,35 +124,26 @@ TestShell::~TestShell() {
}
}
-void TestShell::ShutdownTestShell() {
#if defined(OS_WIN)
- OleUninitialize();
-#endif
- SimpleResourceLoaderBridge::Shutdown();
- delete window_list_;
- delete TestShell::web_prefs_;
-}
-
// All fatal log messages (e.g. DCHECK failures) imply unit test failures
static void UnitTestAssertHandler(const std::string& str) {
FAIL() << str;
}
+#endif
// static
void TestShell::InitLogging(bool suppress_error_dialogs,
bool running_layout_tests) {
- if (suppress_error_dialogs)
- logging::SetLogAssertHandler(UnitTestAssertHandler);
-
#if defined(OS_WIN)
- if (!IsDebuggerPresent()) {
+ if (!IsDebuggerPresent() && suppress_error_dialogs) {
UINT new_flags = SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX;
- // Preserve existing error mode, as discussed at
- // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
+ // Preserve existing error mode, as discussed at http://t/dmea
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
+
+ logging::SetLogAssertHandler(UnitTestAssertHandler);
}
#endif
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index d3d4b0d..1c05414 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -27,6 +27,7 @@
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/plugins/plugin_list.h"
+#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#define MAX_LOADSTRING 100
@@ -74,6 +75,13 @@ void TestShell::InitializeTestShell(bool interactive) {
ResetWebPreferences();
}
+void TestShell::ShutdownTestShell() {
+ delete window_list_;
+ SimpleResourceLoaderBridge::Shutdown();
+ delete TestShell::web_prefs_;
+ OleUninitialize();
+}
+
bool TestShell::CreateNewWindow(const std::wstring& startingURL,
TestShell** result) {
TestShell* shell = new TestShell();