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

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

Issue 10963061: Switch AutomationTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 host, L"", ASCIIToWide(script))); 97 host, L"", ASCIIToWide(script)));
98 } else { 98 } else {
99 script += "window.domAutomationController.setAutomationId(0);" 99 script += "window.domAutomationController.setAutomationId(0);"
100 "window.domAutomationController.send(0);"; 100 "window.domAutomationController.send(0);";
101 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(script)); 101 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(script));
102 } 102 }
103 } 103 }
104 104
105 // Returns the |AutomationTabHelper| for the first browser's first tab. 105 // Returns the |AutomationTabHelper| for the first browser's first tab.
106 AutomationTabHelper* tab_helper() { 106 AutomationTabHelper* tab_helper() {
107 return chrome::GetTabContentsAt(browser(), 0)->automation_tab_helper(); 107 return AutomationTabHelper::FromWebContents(
108 chrome::GetWebContentsAt(browser(), 0));
108 } 109 }
109 110
110 protected: 111 protected:
111 FilePath test_data_dir_; 112 FilePath test_data_dir_;
112 }; 113 };
113 114
114 IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, FormSubmission) { 115 IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, FormSubmission) {
115 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL( 116 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(
116 test_data_dir_.AppendASCII("client_redirects.html"))); 117 test_data_dir_.AppendASCII("client_redirects.html")));
117 118
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, 208 IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest,
208 CrashedTabStopsLoading) { 209 CrashedTabStopsLoading) {
209 MockTabEventObserver mock_tab_observer(tab_helper()); 210 MockTabEventObserver mock_tab_observer(tab_helper());
210 211
211 testing::InSequence expect_in_sequence; 212 testing::InSequence expect_in_sequence;
212 EXPECT_CALL(mock_tab_observer, OnFirstPendingLoad(_)); 213 EXPECT_CALL(mock_tab_observer, OnFirstPendingLoad(_));
213 EXPECT_CALL(mock_tab_observer, OnNoMorePendingLoads(_)); 214 EXPECT_CALL(mock_tab_observer, OnNoMorePendingLoads(_));
214 215
215 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); 216 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL));
216 } 217 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_tab_helper.cc ('k') | chrome/browser/automation/automation_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698