summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 18:05:18 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 18:05:18 +0000
commit570f328ddb63301935e22cfa2e61564d595e0288 (patch)
tree849868a6d21c4da71d834bc327c582d6a12b0f17 /chrome/browser/dom_ui
parentbebee5f93a17703b1751e9f9ab09ea61156f1283 (diff)
downloadchromium_src-570f328ddb63301935e22cfa2e61564d595e0288.zip
chromium_src-570f328ddb63301935e22cfa2e61564d595e0288.tar.gz
chromium_src-570f328ddb63301935e22cfa2e61564d595e0288.tar.bz2
Add a ui test to verify that using the typical_history profile
results in thumbnails. I could have added this directly to the new tab startup tests, but that would mean turning on DOM automation for the new tab tests. I was trying to avoid the extra code in the new tab startup tests. Review URL: http://codereview.chromium.org/269060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui_uitest.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
new file mode 100644
index 0000000..0a0b4bc
--- /dev/null
+++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 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/test/ui/ui_test.h"
+
+#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/test/automation/browser_proxy.h"
+#include "chrome/test/automation/tab_proxy.h"
+#include "chrome/test/automation/window_proxy.h"
+
+class NewTabUITest : public UITest {
+ public:
+ NewTabUITest() {
+ dom_automation_enabled_ = true;
+
+ // Setup the DEFAULT_THEME profile (has fake history entries).
+ set_template_user_data(UITest::ComputeTypicalUserDataSource(
+ UITest::DEFAULT_THEME));
+ }
+};
+
+TEST_F(NewTabUITest, NTPHasThumbnails) {
+ // Switch to the "new tab" tab, which should be any new tab after the
+ // first (the first is about:blank).
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(window.get());
+
+ int tab_count = -1;
+ ASSERT_TRUE(window->GetTabCount(&tab_count));
+ ASSERT_EQ(1, tab_count);
+
+ // Bring up a new tab page.
+ window->ApplyAccelerator(IDC_NEW_TAB);
+ WaitUntilTabCount(2);
+ int load_time;
+ ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time));
+
+ // Blank thumbnails on the NTP have the class 'filler' applied to the div.
+ // If all the thumbnails load, there should be no div's with 'filler'.
+ scoped_refptr<TabProxy> tab = window->GetActiveTab();
+ int filler_thumbnails_count = -1;
+ ASSERT_TRUE(tab->ExecuteAndExtractInt(L"",
+ L"window.domAutomationController.send("
+ L"document.getElementsByClassName('filler').length)",
+ &filler_thumbnails_count));
+ EXPECT_EQ(0, filler_thumbnails_count);
+}