| 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 // This file contains the definition for LayoutTestController. |     5 // This file contains the definition for LayoutTestController. | 
|     6  |     6  | 
|     7 #include <vector> |     7 #include <vector> | 
|     8  |     8  | 
|     9 #include "webkit/tools/test_shell/layout_test_controller.h" |     9 #include "webkit/tools/test_shell/layout_test_controller.h" | 
|    10  |    10  | 
|    11 #include "base/basictypes.h" |    11 #include "base/basictypes.h" | 
|    12 #include "base/file_path.h" |    12 #include "base/file_path.h" | 
|    13 #include "base/logging.h" |    13 #include "base/logging.h" | 
|    14 #include "base/message_loop.h" |    14 #include "base/message_loop.h" | 
|    15 #include "base/path_service.h" |    15 #include "base/path_service.h" | 
|    16 #include "base/string_util.h" |    16 #include "base/string_util.h" | 
|    17 #include "webkit/api/public/WebConsoleMessage.h" |    17 #include "webkit/api/public/WebConsoleMessage.h" | 
|    18 #include "webkit/api/public/WebFrame.h" |    18 #include "webkit/api/public/WebFrame.h" | 
|    19 #include "webkit/api/public/WebKit.h" |    19 #include "webkit/api/public/WebKit.h" | 
|    20 #include "webkit/api/public/WebScriptSource.h" |    20 #include "webkit/api/public/WebScriptSource.h" | 
|    21 #include "webkit/api/public/WebSecurityPolicy.h" |    21 #include "webkit/api/public/WebSecurityPolicy.h" | 
|    22 #include "webkit/api/public/WebURL.h" |    22 #include "webkit/api/public/WebURL.h" | 
|    23 #include "webkit/api/public/WebView.h" |    23 #include "webkit/api/public/WebView.h" | 
|    24 #include "webkit/glue/dom_operations.h" |    24 #include "webkit/glue/dom_operations.h" | 
 |    25 #include "webkit/glue/webkit_glue.h" | 
|    25 #include "webkit/glue/webpreferences.h" |    26 #include "webkit/glue/webpreferences.h" | 
|    26 #include "webkit/tools/test_shell/simple_database_system.h" |    27 #include "webkit/tools/test_shell/simple_database_system.h" | 
|    27 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |    28 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 
|    28 #include "webkit/tools/test_shell/test_navigation_controller.h" |    29 #include "webkit/tools/test_shell/test_navigation_controller.h" | 
|    29 #include "webkit/tools/test_shell/test_shell.h" |    30 #include "webkit/tools/test_shell/test_shell.h" | 
|    30  |    31  | 
|    31 using std::string; |    32 using std::string; | 
|    32 using std::wstring; |    33 using std::wstring; | 
|    33  |    34  | 
|    34 using WebKit::WebConsoleMessage; |    35 using WebKit::WebConsoleMessage; | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   110   BindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::e
      lementDoesAutoCompleteForElementWithId); |   111   BindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::e
      lementDoesAutoCompleteForElementWithId); | 
|   111   BindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAn
      imations); |   112   BindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAn
      imations); | 
|   112   BindMethod("disableImageLoading", &LayoutTestController::disableImageLoading); |   113   BindMethod("disableImageLoading", &LayoutTestController::disableImageLoading); | 
|   113   BindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEna
      bled); |   114   BindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEna
      bled); | 
|   114   BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDe
      legate); |   115   BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDe
      legate); | 
|   115   BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelega
      te); |   116   BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelega
      te); | 
|   116   BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::s
      etWillSendRequestReturnsNullOnRedirect); |   117   BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::s
      etWillSendRequestReturnsNullOnRedirect); | 
|   117   BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccess
      FromOrigin); |   118   BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccess
      FromOrigin); | 
|   118   BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases); |   119   BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases); | 
|   119   BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); |   120   BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale); | 
 |   121   BindMethod("counterValueForElementById", &LayoutTestController::counterValueFo
      rElementById); | 
|   120  |   122  | 
|   121   // The following are stubs. |   123   // The following are stubs. | 
|   122   BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); |   124   BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); | 
|   123   BindMethod("setMainFrameIsFirstResponder", &LayoutTestController::setMainFrame
      IsFirstResponder); |   125   BindMethod("setMainFrameIsFirstResponder", &LayoutTestController::setMainFrame
      IsFirstResponder); | 
|   124   BindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect); |   126   BindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect); | 
|   125   BindMethod("display", &LayoutTestController::display); |   127   BindMethod("display", &LayoutTestController::display); | 
|   126   BindMethod("testRepaint", &LayoutTestController::testRepaint); |   128   BindMethod("testRepaint", &LayoutTestController::testRepaint); | 
|   127   BindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHori
      zontally); |   129   BindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHori
      zontally); | 
|   128   BindMethod("clearBackForwardList", &LayoutTestController::clearBackForwardList
      ); |   130   BindMethod("clearBackForwardList", &LayoutTestController::clearBackForwardList
      ); | 
|   129   BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); |   131   BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); | 
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   985  |   987  | 
|   986 void LayoutTestController::setPOSIXLocale(const CppArgumentList& args, |   988 void LayoutTestController::setPOSIXLocale(const CppArgumentList& args, | 
|   987                                           CppVariant* result) { |   989                                           CppVariant* result) { | 
|   988   result->SetNull(); |   990   result->SetNull(); | 
|   989   if (args.size() == 1 && args[0].isString()) { |   991   if (args.size() == 1 && args[0].isString()) { | 
|   990     std::string new_locale = args[0].ToString(); |   992     std::string new_locale = args[0].ToString(); | 
|   991     setlocale(LC_ALL, new_locale.c_str()); |   993     setlocale(LC_ALL, new_locale.c_str()); | 
|   992   } |   994   } | 
|   993 } |   995 } | 
|   994  |   996  | 
 |   997 void LayoutTestController::counterValueForElementById( | 
 |   998     const CppArgumentList& args, CppVariant* result) { | 
 |   999   result->SetNull(); | 
 |  1000   if (args.size() < 1 || !args[0].isString()) | 
 |  1001     return; | 
 |  1002   std::wstring counterValue; | 
 |  1003   if (!webkit_glue::CounterValueForElementById(shell_->webView()->mainFrame(), | 
 |  1004                                                args[0].ToString(), | 
 |  1005                                                &counterValue)) | 
 |  1006     return; | 
 |  1007   result->Set(WideToUTF8(counterValue)); | 
 |  1008 } | 
 |  1009  | 
|   995 void LayoutTestController::LogErrorToConsole(const std::string& text) { |  1010 void LayoutTestController::LogErrorToConsole(const std::string& text) { | 
|   996   shell_->delegate()->didAddMessageToConsole( |  1011   shell_->delegate()->didAddMessageToConsole( | 
|   997       WebConsoleMessage(WebConsoleMessage::LevelError, |  1012       WebConsoleMessage(WebConsoleMessage::LevelError, | 
|   998                         WebString::fromUTF8(text)), |  1013                         WebString::fromUTF8(text)), | 
|   999       WebString(), 0); |  1014       WebString(), 0); | 
|  1000 } |  1015 } | 
| OLD | NEW |