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

Side by Side Diff: chrome/browser/automation/automation_misc_browsertest.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 years, 11 months 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
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 OnSuccess( 68 OnSuccess(
69 testing::AllOf( 69 testing::AllOf(
70 testing::Property(&gfx::Point::x, testing::Eq(5)), 70 testing::Property(&gfx::Point::x, testing::Eq(5)),
71 testing::Property(&gfx::Point::y, testing::Eq(10))))) 71 testing::Property(&gfx::Point::y, testing::Eq(10)))))
72 .Times(2); 72 .Times(2);
73 73
74 content::RenderViewHost* view = 74 content::RenderViewHost* view =
75 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 75 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
76 ASSERT_TRUE(content::ExecuteJavaScript( 76 ASSERT_TRUE(content::ExecuteJavaScript(
77 view, 77 view,
78 L"", 78 "",
79 L"window.didClick = false;" 79 "window.didClick = false;"
80 L"document.body.innerHTML =" 80 "document.body.innerHTML ="
81 L" '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';" 81 " '<a style=\\'position:absolute; left:0; top:0\\'>link</a>';"
82 L"document.querySelector('a').addEventListener('click', function() {" 82 "document.querySelector('a').addEventListener('click', function() {"
83 L" window.didClick = true;" 83 " window.didClick = true;"
84 L"}, true);")); 84 "}, true);"));
85 AutomationMouseEvent automation_event; 85 AutomationMouseEvent automation_event;
86 automation_event.location_script_chain.push_back( 86 automation_event.location_script_chain.push_back(
87 ScriptEvaluationRequest("{'x': 5, 'y': 10}", "")); 87 ScriptEvaluationRequest("{'x': 5, 'y': 10}", ""));
88 WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event; 88 WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event;
89 mouse_event.type = WebKit::WebInputEvent::MouseDown; 89 mouse_event.type = WebKit::WebInputEvent::MouseDown;
90 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 90 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
91 mouse_event.clickCount = 1; 91 mouse_event.clickCount = 1;
92 new AutomationMouseEventProcessor( 92 new AutomationMouseEventProcessor(
93 view, automation_event, mock.completion_callback(), 93 view, automation_event, mock.completion_callback(),
94 mock.error_callback()); 94 mock.error_callback());
95 mouse_event.type = WebKit::WebInputEvent::MouseUp; 95 mouse_event.type = WebKit::WebInputEvent::MouseUp;
96 new AutomationMouseEventProcessor( 96 new AutomationMouseEventProcessor(
97 view, automation_event, mock.completion_callback(), 97 view, automation_event, mock.completion_callback(),
98 mock.error_callback()); 98 mock.error_callback());
99 99
100 bool did_click = false; 100 bool did_click = false;
101 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 101 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
102 view, 102 view,
103 L"", 103 "",
104 L"window.domAutomationController.send(window.didClick);", 104 "window.domAutomationController.send(window.didClick);",
105 &did_click)); 105 &did_click));
106 EXPECT_TRUE(did_click); 106 EXPECT_TRUE(did_click);
107 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_browsertest.cc ('k') | chrome/browser/automation/automation_tab_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698