| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "net/base/net_util.h" |
| 15 | 16 |
| 16 std::wstring TestShellTest::GetTestURL(const FilePath& test_case_path, | 17 GURL TestShellTest::GetTestURL(const FilePath& test_case_path, |
| 17 const std::string& test_case) { | 18 const std::string& test_case) { |
| 18 return test_case_path.AppendASCII(test_case).ToWStringHack(); | 19 return net::FilePathToFileURL(test_case_path.AppendASCII(test_case)); |
| 19 } | 20 } |
| 20 | 21 |
| 21 void TestShellTest::SetUp() { | 22 void TestShellTest::SetUp() { |
| 22 // Make a test shell for use by the test. | 23 // Make a test shell for use by the test. |
| 23 CreateEmptyWindow(); | 24 CreateEmptyWindow(); |
| 24 test_shell_->Show(WebKit::WebNavigationPolicyNewWindow); | 25 test_shell_->Show(WebKit::WebNavigationPolicyNewWindow); |
| 25 | 26 |
| 26 // Point data_dir_ to the root of the test case dir | 27 // Point data_dir_ to the root of the test case dir |
| 27 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); | 28 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); |
| 28 data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("webkit")); | 29 data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("webkit")); |
| 29 data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("data")); | 30 data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("data")); |
| 30 ASSERT_TRUE(file_util::PathExists(data_dir_)); | 31 ASSERT_TRUE(file_util::PathExists(data_dir_)); |
| 31 } | 32 } |
| 32 | 33 |
| 33 void TestShellTest::TearDown() { | 34 void TestShellTest::TearDown() { |
| 34 // Loading a blank url clears the memory in the current page. | 35 // Loading a blank url clears the memory in the current page. |
| 35 test_shell_->LoadURL(L"about:blank"); | 36 test_shell_->LoadURL(GURL("about:blank")); |
| 36 test_shell_->DestroyWindow(test_shell_->mainWnd()); | 37 test_shell_->DestroyWindow(test_shell_->mainWnd()); |
| 37 LayoutTestController::ClearShell(); | 38 LayoutTestController::ClearShell(); |
| 38 | 39 |
| 39 // Flush the MessageLoop of any residual tasks. | 40 // Flush the MessageLoop of any residual tasks. |
| 40 MessageLoop::current()->RunAllPending(); | 41 MessageLoop::current()->RunAllPending(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void TestShellTest::CreateEmptyWindow() { | 44 void TestShellTest::CreateEmptyWindow() { |
| 44 TestShell::CreateNewWindow(L"about:blank", &test_shell_); | 45 TestShell::CreateNewWindow(GURL("about:blank"), &test_shell_); |
| 45 } | 46 } |
| OLD | NEW |