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

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

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

Powered by Google App Engine
This is Rietveld 408576698