diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 17:55:40 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 17:55:40 +0000 |
commit | d4954f603c6480c6ec528e40a16d79ad36a6d500 (patch) | |
tree | 3e50c86cccbdecc0437df0be98f9748f917af8a4 | |
parent | c06b92f10080174083fe8abfa9d7145c9e469220 (diff) | |
download | chromium_src-d4954f603c6480c6ec528e40a16d79ad36a6d500.zip chromium_src-d4954f603c6480c6ec528e40a16d79ad36a6d500.tar.gz chromium_src-d4954f603c6480c6ec528e40a16d79ad36a6d500.tar.bz2 |
Convert NewTabUITest.ChromeInternalLoadsNTP to a browser_test.
BUG=45001
TEST=NewTabUIBrowserTest.ChromeInternalLoadsNTP passes
Review URL: http://codereview.chromium.org/8400048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108496 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc | 21 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 |
3 files changed, 31 insertions, 21 deletions
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc new file mode 100644 index 0000000..e127329 --- /dev/null +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -0,0 +1,30 @@ +// 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/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "content/browser/tab_contents/tab_contents.h" +#include "googleurl/src/gurl.h" + +class NewTabUIBrowserTest : public InProcessBrowserTest { + public: + NewTabUIBrowserTest() { + EnableDOMAutomation(); + } +}; + +// Ensure that chrome-internal: still loads the NTP. +// See http://crbug.com/6564. +IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { + // Go to the "new tab page" using its old url, rather than chrome://newtab. + // Ensure that we get there by checking for non-empty page content. + ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); + bool empty_inner_html = false; + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( + browser()->GetTabContentsAt(0)->render_view_host(), L"", + L"window.domAutomationController.send(document.body.innerHTML == '')", + &empty_inner_html)); + ASSERT_FALSE(empty_inner_html); +} diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc index 79c4f49..1c42227 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc @@ -161,24 +161,3 @@ TEST_F(NewTabUIProcessPerTabTest, MAYBE_NavBeforeNTPCommits) { ASSERT_TRUE(tab2.get()); ASSERT_TRUE(tab2->NavigateToURL(GURL("data:text/html,hello world"))); } - -// Fails about ~5% of the time on all platforms. http://crbug.com/45001 -TEST_F(NewTabUITest, FLAKY_ChromeInternalLoadsNTP) { - scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); - ASSERT_TRUE(window.get()); - - // Go to the "new tab page" using its old url, rather than chrome://newtab. - scoped_refptr<TabProxy> tab = window->GetTab(0); - ASSERT_TRUE(tab.get()); - ASSERT_TRUE(tab->NavigateToURLAsync(GURL("chrome-internal:"))); - int load_time; - ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); - - // Ensure there are some thumbnails loaded in the page. - int thumbnails_count = -1; - ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", - L"window.domAutomationController.send(" - L"document.getElementsByClassName('thumbnail-container').length)", - &thumbnails_count)); - EXPECT_GT(thumbnails_count, 0); -} diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index ae7609b..6a5b554 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2564,6 +2564,7 @@ 'browser/ui/webui/bidi_checker_web_ui_test.cc', 'browser/ui/webui/bidi_checker_web_ui_test.h', 'browser/ui/webui/net_internals_ui_browsertest.cc', + 'browser/ui/webui/ntp/new_tab_ui_browsertest.cc', 'browser/ui/webui/options/advanced_options_browsertest.js', 'browser/ui/webui/options/autofill_options_browsertest.js', 'browser/ui/webui/options/browser_options_browsertest.js', |