diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-04 16:36:25 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-04 16:36:25 +0000 |
commit | 17c4f3c7c289c840f8b285f7834ab7007f85e35e (patch) | |
tree | e21af5a41aba26623cf56d6fe2412c34a32daafc /chrome/test/ui_test_utils.cc | |
parent | cd659ee5e9e02a3fdf261fb9ebdf25801661b5fa (diff) | |
download | chromium_src-17c4f3c7c289c840f8b285f7834ab7007f85e35e.zip chromium_src-17c4f3c7c289c840f8b285f7834ab7007f85e35e.tar.gz chromium_src-17c4f3c7c289c840f8b285f7834ab7007f85e35e.tar.bz2 |
Add an ExtensionBrowserTest base class that allows in-process browser tests of extensions using ExtensionsService directly, rather than TestExtensionLoaded. Use it to re-enable some old browser tests that had been disabled.
Review URL: http://codereview.chromium.org/150213
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.cc')
-rw-r--r-- | chrome/test/ui_test_utils.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index ffe7a2e..ac55380 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -75,9 +75,9 @@ class NavigationNotificationObserver : public NotificationObserver { class DOMOperationObserver : public NotificationObserver { public: - explicit DOMOperationObserver(TabContents* tab_contents) { + explicit DOMOperationObserver(RenderViewHost* render_view_host) { registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, - Source<TabContents>(tab_contents)); + Source<RenderViewHost>(render_view_host)); RunMessageLoop(); } @@ -230,16 +230,15 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, WaitForNavigations(controller, number_of_navigations); } -Value* ExecuteJavaScript(TabContents* tab_contents, +Value* ExecuteJavaScript(RenderViewHost* render_view_host, const std::wstring& frame_xpath, const std::wstring& original_script) { // TODO(jcampan): we should make the domAutomationController not require an // automation id. std::wstring script = L"window.domAutomationController.setAutomationId(0);" + original_script; - tab_contents->render_view_host()->ExecuteJavascriptInWebFrame(frame_xpath, - script); - DOMOperationObserver dom_op_observer(tab_contents); + render_view_host->ExecuteJavascriptInWebFrame(frame_xpath, script); + DOMOperationObserver dom_op_observer(render_view_host); std::string json = dom_op_observer.response(); // Wrap |json| in an array before deserializing because valid JSON has an // array or an object as the root. @@ -259,36 +258,39 @@ Value* ExecuteJavaScript(TabContents* tab_contents, return result; } -bool ExecuteJavaScriptAndExtractInt(TabContents* tab_contents, +bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host, const std::wstring& frame_xpath, const std::wstring& script, int* result) { DCHECK(result); - scoped_ptr<Value> value(ExecuteJavaScript(tab_contents, frame_xpath, script)); + scoped_ptr<Value> value(ExecuteJavaScript(render_view_host, frame_xpath, + script)); if (!value.get()) return false; return value->GetAsInteger(result); } -bool ExecuteJavaScriptAndExtractBool(TabContents* tab_contents, +bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, const std::wstring& frame_xpath, const std::wstring& script, bool* result) { DCHECK(result); - scoped_ptr<Value> value(ExecuteJavaScript(tab_contents, frame_xpath, script)); + scoped_ptr<Value> value(ExecuteJavaScript(render_view_host, frame_xpath, + script)); if (!value.get()) return false; return value->GetAsBoolean(result); } -bool ExecuteJavaScriptAndExtractString(TabContents* tab_contents, +bool ExecuteJavaScriptAndExtractString(RenderViewHost* render_view_host, const std::wstring& frame_xpath, const std::wstring& script, std::string* result) { DCHECK(result); - scoped_ptr<Value> value(ExecuteJavaScript(tab_contents, frame_xpath, script)); + scoped_ptr<Value> value(ExecuteJavaScript(render_view_host, frame_xpath, + script)); if (!value.get()) return false; |