summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui_test_utils.h
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:50:05 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 21:50:05 +0000
commit9fabbf77b5b467003287b055aece906a4330de86 (patch)
tree3727f1d511342a55c9ece39c7a7b264f027081f8 /chrome/test/ui_test_utils.h
parentee520884a87f24a5e34ef660657d49f2ec993f6e (diff)
downloadchromium_src-9fabbf77b5b467003287b055aece906a4330de86.zip
chromium_src-9fabbf77b5b467003287b055aece906a4330de86.tar.gz
chromium_src-9fabbf77b5b467003287b055aece906a4330de86.tar.bz2
Make ui_test_utils::ExecuteJavaScript() friendlier to use. Also, add WARN_UNUSED_RESULT to make it less likely that callers ignore failures.
BUG=57216 TEST=tests should still run Review URL: http://codereview.chromium.org/3569005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.h')
-rw-r--r--chrome/test/ui_test_utils.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index 9e6a2e1..fef6f6b5 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -107,11 +107,13 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser,
DOMElementProxyRef GetActiveDOMDocument(Browser* browser);
// Executes the passed |script| in the frame pointed to by |frame_xpath| (use
-// empty string for main frame) and returns the value the evaluation of the
-// script returned. The caller owns the returned value.
-Value* ExecuteJavaScript(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& script);
+// empty string for main frame). The |script| should not invoke
+// domAutomationController.send(); otherwise, your test will hang or be flaky.
+// If you want to extract a result, use one of the below functions.
+// Returns true on success.
+bool ExecuteJavaScript(RenderViewHost* render_view_host,
+ const std::wstring& frame_xpath,
+ const std::wstring& script) WARN_UNUSED_RESULT;
// The following methods executes the passed |script| in the frame pointed to by
// |frame_xpath| (use empty string for main frame) and sets |result| to the
@@ -123,15 +125,15 @@ Value* ExecuteJavaScript(RenderViewHost* render_view_host,
bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host,
const std::wstring& frame_xpath,
const std::wstring& script,
- int* result);
+ int* result) WARN_UNUSED_RESULT;
bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host,
const std::wstring& frame_xpath,
const std::wstring& script,
- bool* result);
+ bool* result) WARN_UNUSED_RESULT;
bool ExecuteJavaScriptAndExtractString(RenderViewHost* render_view_host,
const std::wstring& frame_xpath,
const std::wstring& script,
- std::string* result);
+ std::string* result) WARN_UNUSED_RESULT;
// Generate the file path for testing a particular test.
// The file for the tests is all located in