OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "chrome/browser/automation/automation_provider_observers.h" | 9 #include "chrome/browser/automation/automation_provider_observers.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); | 75 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); |
76 ASSERT_TRUE(content::ExecuteScript( | 76 ASSERT_TRUE(content::ExecuteScript( |
77 view, | 77 view, |
78 "window.didClick = false;" | 78 "window.didClick = false;" |
79 "document.body.innerHTML =" | 79 "document.body.innerHTML =" |
80 " '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';" | 80 " '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';" |
81 "document.querySelector('a').addEventListener('click', function() {" | 81 "document.querySelector('a').addEventListener('click', function() {" |
82 " window.didClick = true;" | 82 " window.didClick = true;" |
83 "}, true);")); | 83 "}, true);")); |
84 AutomationMouseEvent automation_event; | 84 AutomationMouseEvent automation_event; |
85 automation_event.location_script_chain.push_back( | 85 automation_event.location_script_chain |
86 ScriptEvaluationRequest("{'x': 5, 'y': 10}", "")); | 86 .push_back(ScriptEvaluationRequest("{'x': 5, 'y': 10}", std::string())); |
87 WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event; | 87 WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event; |
88 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 88 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
89 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 89 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
90 mouse_event.clickCount = 1; | 90 mouse_event.clickCount = 1; |
91 new AutomationMouseEventProcessor( | 91 new AutomationMouseEventProcessor( |
92 view, automation_event, mock.completion_callback(), | 92 view, automation_event, mock.completion_callback(), |
93 mock.error_callback()); | 93 mock.error_callback()); |
94 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 94 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
95 new AutomationMouseEventProcessor( | 95 new AutomationMouseEventProcessor( |
96 view, automation_event, mock.completion_callback(), | 96 view, automation_event, mock.completion_callback(), |
97 mock.error_callback()); | 97 mock.error_callback()); |
98 | 98 |
99 bool did_click = false; | 99 bool did_click = false; |
100 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 100 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
101 view, | 101 view, |
102 "window.domAutomationController.send(window.didClick);", | 102 "window.domAutomationController.send(window.didClick);", |
103 &did_click)); | 103 &did_click)); |
104 EXPECT_TRUE(did_click); | 104 EXPECT_TRUE(did_click); |
105 } | 105 } |
OLD | NEW |