summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 17:55:40 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 17:55:40 +0000
commitd4954f603c6480c6ec528e40a16d79ad36a6d500 (patch)
tree3e50c86cccbdecc0437df0be98f9748f917af8a4 /chrome/browser
parentc06b92f10080174083fe8abfa9d7145c9e469220 (diff)
downloadchromium_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
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc30
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc21
2 files changed, 30 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);
-}