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

Unified Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 7146024: Use ExecuteJavascriptInWebFrameNotifyResult to return results even in error condition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use the gtest-spi EXPECT_FATAL_FAILURE with SCOPED_TRACE to gracefully test failure. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/web_ui_test_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/web_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc
index 3817612619a61c8a7daf4884bbc5cab12a9f0e53..d23847f7a7f02715748120083f7429c79dc6173c 100644
--- a/chrome/browser/ui/webui/web_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/web_ui_browsertest.cc
@@ -15,6 +15,7 @@
#include "chrome/test/ui_test_utils.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/webui/web_ui.h"
+#include "testing/gtest/include/gtest/gtest-spi.h"
#include "ui/base/resource/resource_bundle.h"
static const FilePath::CharType* kWebUILibraryJS =
@@ -201,6 +202,25 @@ IN_PROC_BROWSER_TEST_F(WebUIBrowserTest, TestSamplePass) {
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL));
ASSERT_TRUE(RunJavascriptTest("testAssertFalse"));
+ ASSERT_FALSE(RunJavascriptTest("FAILS_testAssertFalse"));
ASSERT_TRUE(RunJavascriptTest("testInitialFocus"));
ASSERT_FALSE(RunJavascriptTest("testConsoleError"));
}
+
+class WebUIBrowserExpectFailTest : public WebUIBrowserTest {
+ protected:
+ static WebUIBrowserTest* s_test_;
Paweł Hajdan Jr. 2011/06/15 17:16:20 Hm, I'm not a fan of this s_test variable. How abo
+ static void RunJavascriptTestNoReturn(const std::string& testname) {
+ s_test_->RunJavascriptTest(testname);
+ }
+};
+WebUIBrowserTest* WebUIBrowserExpectFailTest::s_test_ = NULL;
+
+IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsFast) {
+ AddLibrary(FilePath(FILE_PATH_LITERAL("sample_downloads.js")));
+ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL));
+
+ s_test_ = this;
+ EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"),
+ "WebUITestHandler::Observe");
+}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/web_ui_test_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698