diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 01:16:38 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 01:16:38 +0000 |
commit | 049231918a23ba6f800070d15fdcbe567c7020de (patch) | |
tree | 991ab34ddf18741201fe318f122a8739f5ff37ed | |
parent | 2e1d5e1f4fd17cb2caf06834849c2fec9ad76cbd (diff) | |
download | chromium_src-049231918a23ba6f800070d15fdcbe567c7020de.zip chromium_src-049231918a23ba6f800070d15fdcbe567c7020de.tar.gz chromium_src-049231918a23ba6f800070d15fdcbe567c7020de.tar.bz2 |
Revert 108924 - Tests for WebUI Hung Renderer Dialog
This CL adds a WebUIBrowserTest to test the WebUI Hung Renderer Dialog.
(Reverted due to repeated failures in .testHungRenderer)
BUG=102073
TEST=browser_tests HungRendererDialogUITest.testHungRenderer
Review URL: http://codereview.chromium.org/8372042
TBR=wyck@chromium.org
Review URL: http://codereview.chromium.org/8497001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108960 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/hung_renderer_dialog.js | 4 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | chrome/test/data/webui/hung_renderer_dialog_test.js | 63 | ||||
-rw-r--r-- | chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h | 52 |
4 files changed, 2 insertions, 119 deletions
diff --git a/chrome/browser/resources/hung_renderer_dialog.js b/chrome/browser/resources/hung_renderer_dialog.js index a971b92..9df4fac 100644 --- a/chrome/browser/resources/hung_renderer_dialog.js +++ b/chrome/browser/resources/hung_renderer_dialog.js @@ -56,7 +56,7 @@ cr.define('hungRendererDialog', function() { if (cr.isViews) forEach(document.querySelectorAll('.button-strip'), reverseChildren); - chrome.send('requestTabContentsList'); + chrome.send('requestTabContentsList') } /** @@ -74,7 +74,7 @@ cr.define('hungRendererDialog', function() { listItem.style.backgroundImage = url('chrome://favicon/size/32/' + tabDetailsList[i].url); listItem.textContent = tabDetailsList[i].title; - $('tab-table').appendChild(listItem); + $('tab-table').appendChild(listItem) } } diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3e8a77c..c585f2a 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2647,8 +2647,6 @@ 'test/data/webui/async_gen.js', 'test/data/webui/certificate_viewer_dialog_test.js', 'test/data/webui/certificate_viewer_ui_test-inl.h', - 'test/data/webui/hung_renderer_dialog_test.js', - 'test/data/webui/hung_renderer_dialog_ui_test-inl.h', 'test/data/webui/ntp4.js', 'test/data/webui/print_preview.js', # TODO(craig): Rename this and run from base_unittests when the test diff --git a/chrome/test/data/webui/hung_renderer_dialog_test.js b/chrome/test/data/webui/hung_renderer_dialog_test.js deleted file mode 100644 index 4354de1..0000000 --- a/chrome/test/data/webui/hung_renderer_dialog_test.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Test fixture for generated tests. - * @extends {testing.Test} - */ -function HungRendererDialogUITest() {}; - -HungRendererDialogUITest.prototype = { - __proto__: testing.Test.prototype, - - /** - * Define the C++ fixture class and include it. - * @type {?string} - * @override - */ - typedefCppFixture: 'HungRendererDialogUITest', -}; - -// Include the bulk of c++ code. -GEN('#include "chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h"'); - -// Constructors and destructors must be provided in .cc to prevent clang errors. -GEN('HungRendererDialogUITest::HungRendererDialogUITest() {}'); -GEN('HungRendererDialogUITest::~HungRendererDialogUITest() {}'); - -/** - * Confirms that the URL is correct. - */ -TEST_F('HungRendererDialogUITest', 'testURL', function() { - expectEquals(chrome.expectedUrl, window.location.href); -}); - -/** - * Confirms that the theme graphic is loaded and is of a reasonable size. This - * validates that we are integrating properly with the theme source. - */ -TEST_F('HungRendererDialogUITest', 'testThemeGraphicIntegration', function() { - var themeGraphic = $('theme-graphic'); - assertNotEquals(null, themeGraphic); - expectGT(themeGraphic.width, 0); - expectGT(themeGraphic.height, 0); -}); - -/** - * Confirms that the DOM was updated such that a list item representing the - * frozen tab was added to the list of frozen tabs. Also confirms that the list - * item text content is the title of the frozen tab. - */ -TEST_F('HungRendererDialogUITest', 'testHungRenderer', function() { - var tabTable = $('tab-table'); - assertNotEquals(null, tabTable); - assertGT(tabTable.childElementCount, 0); - - var children = tabTable.getElementsByTagName('*'); - assertNotEquals(null, children); - var titleElement = children[0]; - assertNotEquals(null, titleElement); - expectEquals(chrome.expectedTitle, titleElement.textContent); -}); - diff --git a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h b/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h deleted file mode 100644 index c09e5a5..0000000 --- a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/webui/chrome_web_ui.h" -#include "chrome/browser/ui/webui/hung_renderer_dialog.h" -#include "chrome/browser/ui/webui/web_ui_browsertest.h" -#include "chrome/common/url_constants.h" -#include "chrome/test/base/test_html_dialog_observer.h" -#include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/webui/web_ui.h" - -// Test framework for chrome/test/data/webui/hung_renderer_dialog_test.js. -class HungRendererDialogUITest : public WebUIBrowserTest { - public: - HungRendererDialogUITest(); - virtual ~HungRendererDialogUITest(); - - private: - virtual void SetUpOnMainThread() OVERRIDE; -}; - -void HungRendererDialogUITest::SetUpOnMainThread() { - // Force the flag so that we will use the WebUI version of the Dialog. - ChromeWebUI::OverrideMoreWebUI(true); - - // Choose which tab contents to report as hung. In this case, the default - // tab contents will be about:blank. - ASSERT_TRUE(browser() != NULL); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - - // The TestHtmlDialogObserver will catch our dialog when it gets created. - TestHtmlDialogObserver dialog_observer; - - // Show the actual Hung Renderer Dialog. - HungRendererDialog::ShowHungRendererDialog(tab_contents); - - // Now we can get the WebUI object from the observer, and make some details - // about our test available to the JavaScript. - WebUI* webui = dialog_observer.GetWebUI(); - webui->tab_contents()->render_view_host()->SetWebUIProperty( - "expectedUrl", chrome::kChromeUIHungRendererDialogURL); - webui->tab_contents()->render_view_host()->SetWebUIProperty( - "expectedTitle", "about:blank"); - - // Tell the test which WebUI instance we are dealing with and complete - // initialization of this test. - SetWebUIInstance(webui); - WebUIBrowserTest::SetUpOnMainThread(); -} |