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" |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" |
11 #include "chrome/common/automation_constants.h" | 12 #include "chrome/common/automation_constants.h" |
12 #include "chrome/common/automation_events.h" | 13 #include "chrome/common/automation_events.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
20 #include "ui/gfx/point.h" | 21 #include "ui/gfx/point.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { | 66 IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { |
66 MockMouseEventCallback mock; | 67 MockMouseEventCallback mock; |
67 EXPECT_CALL(mock, | 68 EXPECT_CALL(mock, |
68 OnSuccess( | 69 OnSuccess( |
69 testing::AllOf( | 70 testing::AllOf( |
70 testing::Property(&gfx::Point::x, testing::Eq(5)), | 71 testing::Property(&gfx::Point::x, testing::Eq(5)), |
71 testing::Property(&gfx::Point::y, testing::Eq(10))))) | 72 testing::Property(&gfx::Point::y, testing::Eq(10))))) |
72 .Times(2); | 73 .Times(2); |
73 | 74 |
74 content::RenderViewHost* view = | 75 content::RenderViewHost* view = |
75 browser()->GetActiveWebContents()->GetRenderViewHost(); | 76 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
76 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 77 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
77 view, | 78 view, |
78 L"", | 79 L"", |
79 L"window.didClick = false;" | 80 L"window.didClick = false;" |
80 L"document.body.innerHTML =" | 81 L"document.body.innerHTML =" |
81 L" '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';" | 82 L" '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';" |
82 L"document.querySelector('a').addEventListener('click', function() {" | 83 L"document.querySelector('a').addEventListener('click', function() {" |
83 L" window.didClick = true;" | 84 L" window.didClick = true;" |
84 L"}, true);")); | 85 L"}, true);")); |
85 AutomationMouseEvent automation_event; | 86 AutomationMouseEvent automation_event; |
(...skipping 12 matching lines...) Expand all Loading... |
98 mock.error_callback()); | 99 mock.error_callback()); |
99 | 100 |
100 bool did_click = false; | 101 bool did_click = false; |
101 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 102 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
102 view, | 103 view, |
103 L"", | 104 L"", |
104 L"window.domAutomationController.send(window.didClick);", | 105 L"window.domAutomationController.send(window.didClick);", |
105 &did_click)); | 106 &did_click)); |
106 EXPECT_TRUE(did_click); | 107 EXPECT_TRUE(did_click); |
107 } | 108 } |
OLD | NEW |