| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/test_shell_test.h" | 5 #include "webkit/tools/test_shell/test_shell_test.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" |
| 7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 11 | 12 |
| 12 std::wstring TestShellTest::GetTestURL(std::wstring test_case_path, | 13 std::wstring TestShellTest::GetTestURL(std::wstring test_case_path, |
| 13 const std::wstring& test_case) { | 14 const std::wstring& test_case) { |
| 14 file_util::AppendToPath(&test_case_path, test_case); | 15 file_util::AppendToPath(&test_case_path, test_case); |
| 15 return test_case_path; | 16 return test_case_path; |
| 16 } | 17 } |
| 17 | 18 |
| 18 void TestShellTest::SetUp() { | 19 void TestShellTest::SetUp() { |
| 19 // Make a test shell for use by the test. | 20 // Make a test shell for use by the test. |
| 21 #if defined(OS_WIN) |
| 20 TestShell::RegisterWindowClass(); | 22 TestShell::RegisterWindowClass(); |
| 23 #endif |
| 21 CreateEmptyWindow(); | 24 CreateEmptyWindow(); |
| 22 test_shell_->Show(test_shell_->webView(), NEW_WINDOW); | 25 test_shell_->Show(test_shell_->webView(), NEW_WINDOW); |
| 23 | 26 |
| 24 // Point data_dir_ to the root of the test case dir | 27 // Point data_dir_ to the root of the test case dir |
| 25 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); | 28 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); |
| 26 file_util::AppendToPath(&data_dir_, L"webkit"); | 29 file_util::AppendToPath(&data_dir_, L"webkit"); |
| 27 file_util::AppendToPath(&data_dir_, L"data"); | 30 file_util::AppendToPath(&data_dir_, L"data"); |
| 28 ASSERT_TRUE(file_util::PathExists(data_dir_)); | 31 ASSERT_TRUE(file_util::PathExists(data_dir_)); |
| 29 } | 32 } |
| 30 | 33 |
| 31 void TestShellTest::TearDown() { | 34 void TestShellTest::TearDown() { |
| 32 // Loading a blank url clears the memory in the current page. | 35 // Loading a blank url clears the memory in the current page. |
| 33 test_shell_->LoadURL(L"about:blank"); | 36 test_shell_->LoadURL(L"about:blank"); |
| 34 DestroyWindow(test_shell_->mainWnd()); | 37 test_shell_->DestroyWindow(test_shell_->mainWnd()); |
| 35 LayoutTestController::ClearShell(); | 38 LayoutTestController::ClearShell(); |
| 36 | 39 |
| 37 // Flush the MessageLoop of any residual tasks. | 40 // Flush the MessageLoop of any residual tasks. |
| 38 MessageLoop::current()->RunAllPending(); | 41 MessageLoop::current()->RunAllPending(); |
| 39 } | 42 } |
| 40 | 43 |
| 41 void TestShellTest::CreateEmptyWindow() { | 44 void TestShellTest::CreateEmptyWindow() { |
| 42 TestShell::CreateNewWindow(L"about:blank", &test_shell_); | 45 TestShell::CreateNewWindow(L"about:blank", &test_shell_); |
| 43 } | 46 } |
| OLD | NEW |