diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 18:48:06 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 18:48:06 +0000 |
commit | 9b5fd424c6699472c8c93bbc17fcf0c2c85ae765 (patch) | |
tree | c23ce54dc9dd6db1e11fedd736169bc33476849b | |
parent | 4c619e3b7771d9f27a748bcdfe1fd857b13d7d8e (diff) | |
download | chromium_src-9b5fd424c6699472c8c93bbc17fcf0c2c85ae765.zip chromium_src-9b5fd424c6699472c8c93bbc17fcf0c2c85ae765.tar.gz chromium_src-9b5fd424c6699472c8c93bbc17fcf0c2c85ae765.tar.bz2 |
Implement setPOSIXLocale in test shell.
This is needed by a new test: fast/css/opacity-float-expected.txt.
Review URL: http://codereview.chromium.org/271003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28280 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 12 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index a57a383..3dd2be2 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -127,6 +127,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::setWillSendRequestReturnsNullOnRedirect); BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccessFromOrigin); BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases); + BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -436,6 +437,8 @@ void LayoutTestController::Reset() { SimpleResourceLoaderBridge::SetAcceptAllCookies(false); WebKit::resetOriginAccessWhiteLists(); + setlocale(LC_ALL, ""); + if (close_remaining_windows_) { // Iterate through the window list and close everything except the original // shell. We don't want to delete elements as we're iterating, so we copy @@ -971,6 +974,15 @@ void LayoutTestController::clearAllDatabases( SimpleDatabaseSystem::GetInstance()->ClearAllDatabases(); } +void LayoutTestController::setPOSIXLocale(const CppArgumentList& args, + CppVariant* result) { + result->SetNull(); + if (args.size() == 1 && args[0].isString()) { + std::string new_locale = args[0].ToString(); + setlocale(LC_ALL, new_locale.c_str()); + } +} + void LayoutTestController::LogErrorToConsole(const std::string& text) { shell_->delegate()->didAddMessageToConsole( WebConsoleMessage(WebConsoleMessage::LevelError, diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 5b65653..5aafc85 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -200,6 +200,10 @@ class LayoutTestController : public CppBoundClass { // Clears all databases. void clearAllDatabases(const CppArgumentList& args, CppVariant* result); + // Calls setlocale(LC_ALL, ...) for a specified locale. + // Resets between tests. + void setPOSIXLocale(const CppArgumentList& args, CppVariant* result); + public: // The following methods are not exposed to JavaScript. void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } |