Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: webkit/tools/test_shell/layout_test_controller.cc

Issue 5744005: Revert rev 69137 due to incorrect change log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/tools/test_shell/test_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base64.h" 11 #include "base/base64.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "net/base/net_util.h" 20 #include "net/base/net_util.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" 21 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h"
22 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" 22 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h"
23 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" 23 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
24 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientation.h" 24 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientation.h"
25 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo ck.h" 25 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo ck.h"
26 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" 26 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
27 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" 27 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
28 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 28 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
29 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
30 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h"
31 #else
32 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" 29 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h"
33 #endif
34 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" 30 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
35 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" 31 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
36 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" 32 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
37 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" 33 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h"
38 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" 34 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
39 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock .h" 35 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock .h"
40 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" 36 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
41 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 37 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
42 #include "webkit/glue/dom_operations.h" 38 #include "webkit/glue/dom_operations.h"
43 #include "webkit/glue/webkit_glue.h" 39 #include "webkit/glue/webkit_glue.h"
44 #include "webkit/glue/webpreferences.h" 40 #include "webkit/glue/webpreferences.h"
45 #include "webkit/tools/test_shell/notification_presenter.h" 41 #include "webkit/tools/test_shell/notification_presenter.h"
46 #include "webkit/tools/test_shell/simple_database_system.h" 42 #include "webkit/tools/test_shell/simple_database_system.h"
47 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 43 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
48 #include "webkit/tools/test_shell/test_navigation_controller.h" 44 #include "webkit/tools/test_shell/test_navigation_controller.h"
49 #include "webkit/tools/test_shell/test_shell.h" 45 #include "webkit/tools/test_shell/test_shell.h"
50 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" 46 #include "webkit/tools/test_shell/test_shell_devtools_agent.h"
51 #include "webkit/tools/test_shell/test_webview_delegate.h" 47 #include "webkit/tools/test_shell/test_webview_delegate.h"
52 48
53 using std::string; 49 using std::string;
54 using std::wstring; 50 using std::wstring;
55 51
56 using WebKit::WebBindings; 52 using WebKit::WebBindings;
57 using WebKit::WebConsoleMessage; 53 using WebKit::WebConsoleMessage;
58 using WebKit::WebElement; 54 using WebKit::WebElement;
55 using WebKit::WebGeolocationServiceMock;
59 using WebKit::WebScriptSource; 56 using WebKit::WebScriptSource;
60 using WebKit::WebSecurityPolicy; 57 using WebKit::WebSecurityPolicy;
61 using WebKit::WebSize; 58 using WebKit::WebSize;
62 using WebKit::WebString; 59 using WebKit::WebString;
63 using WebKit::WebURL; 60 using WebKit::WebURL;
64 61
65 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION)
66 using WebKit::WebGeolocationServiceMock;
67 #endif
68
69 TestShell* LayoutTestController::shell_ = NULL; 62 TestShell* LayoutTestController::shell_ = NULL;
70 // Most of these flags need to be cleared in Reset() so that they get turned 63 // Most of these flags need to be cleared in Reset() so that they get turned
71 // off between each test run. 64 // off between each test run.
72 bool LayoutTestController::generate_pixel_results_ = true; 65 bool LayoutTestController::generate_pixel_results_ = true;
73 bool LayoutTestController::dump_as_text_ = false; 66 bool LayoutTestController::dump_as_text_ = false;
74 bool LayoutTestController::dump_editing_callbacks_ = false; 67 bool LayoutTestController::dump_editing_callbacks_ = false;
75 bool LayoutTestController::dump_frame_load_callbacks_ = false; 68 bool LayoutTestController::dump_frame_load_callbacks_ = false;
76 bool LayoutTestController::dump_resource_load_callbacks_ = false; 69 bool LayoutTestController::dump_resource_load_callbacks_ = false;
77 bool LayoutTestController::dump_resource_response_mime_types_ = false; 70 bool LayoutTestController::dump_resource_response_mime_types_ = false;
78 bool LayoutTestController::dump_back_forward_list_ = false; 71 bool LayoutTestController::dump_back_forward_list_ = false;
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 "Should be 'mac', 'win', or 'unix'."); 1486 "Should be 'mac', 'win', or 'unix'.");
1494 return; 1487 return;
1495 } 1488 }
1496 shell_->webView()->settings()->setEditingBehavior(behavior); 1489 shell_->webView()->settings()->setEditingBehavior(behavior);
1497 } 1490 }
1498 1491
1499 void LayoutTestController::setGeolocationPermission(const CppArgumentList& args, 1492 void LayoutTestController::setGeolocationPermission(const CppArgumentList& args,
1500 CppVariant* result) { 1493 CppVariant* result) {
1501 if (args.size() < 1 || !args[0].isBool()) 1494 if (args.size() < 1 || !args[0].isBool())
1502 return; 1495 return;
1503 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
1504 shell_->geolocation_client_mock()->setPermission(
1505 args[0].ToBoolean());
1506 #else
1507 shell_->delegate()->SetGeolocationPermission(args[0].ToBoolean()); 1496 shell_->delegate()->SetGeolocationPermission(args[0].ToBoolean());
1508 #endif
1509 } 1497 }
1510 1498
1511 void LayoutTestController::setMockGeolocationPosition( 1499 void LayoutTestController::setMockGeolocationPosition(
1512 const CppArgumentList& args, CppVariant* result) { 1500 const CppArgumentList& args, CppVariant* result) {
1513 if (args.size() < 3 || 1501 if (args.size() < 3 ||
1514 !args[0].isNumber() || !args[1].isNumber() || !args[2].isNumber()) 1502 !args[0].isNumber() || !args[1].isNumber() || !args[2].isNumber())
1515 return; 1503 return;
1516 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
1517 shell_->geolocation_client_mock()->setPosition(
1518 args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble());
1519 #else
1520 WebGeolocationServiceMock::setMockGeolocationPosition( 1504 WebGeolocationServiceMock::setMockGeolocationPosition(
1521 args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble()); 1505 args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble());
1522 #endif
1523 } 1506 }
1524 1507
1525 void LayoutTestController::setMockGeolocationError(const CppArgumentList& args, 1508 void LayoutTestController::setMockGeolocationError(const CppArgumentList& args,
1526 CppVariant* result) { 1509 CppVariant* result) {
1527 if (args.size() < 2 || !args[0].isNumber() || !args[1].isString()) 1510 if (args.size() < 2 || !args[0].isNumber() || !args[1].isString())
1528 return; 1511 return;
1529 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
1530 shell_->geolocation_client_mock()->setError(
1531 args[0].ToInt32(), WebString::fromUTF8(args[1].ToString()));
1532 #else
1533 WebGeolocationServiceMock::setMockGeolocationError( 1512 WebGeolocationServiceMock::setMockGeolocationError(
1534 args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); 1513 args[0].ToInt32(), WebString::fromUTF8(args[1].ToString()));
1535 #endif
1536 } 1514 }
1537 1515
1538 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, 1516 void LayoutTestController::markerTextForListItem(const CppArgumentList& args,
1539 CppVariant* result) { 1517 CppVariant* result) {
1540 WebElement element; 1518 WebElement element;
1541 if (!WebBindings::getElement(args[0].value.objectValue, &element)) 1519 if (!WebBindings::getElement(args[0].value.objectValue, &element))
1542 result->SetNull(); 1520 result->SetNull();
1543 else 1521 else
1544 result->Set( 1522 result->Set(
1545 element.document().frame()->markerTextForListItem(element).utf8()); 1523 element.document().frame()->markerTextForListItem(element).utf8());
(...skipping 16 matching lines...) Expand all
1562 shell_->device_orientation_client_mock()->setOrientation(orientation); 1540 shell_->device_orientation_client_mock()->setOrientation(orientation);
1563 } 1541 }
1564 1542
1565 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, 1543 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments,
1566 CppVariant* result) { 1544 CppVariant* result) {
1567 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber ()) 1545 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber ())
1568 return; 1546 return;
1569 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor ( 1547 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor (
1570 arguments[0].ToInt32(), arguments[1].ToInt32())); 1548 arguments[0].ToInt32(), arguments[1].ToInt32()));
1571 } 1549 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | webkit/tools/test_shell/test_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698