From 570f328ddb63301935e22cfa2e61564d595e0288 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Thu, 15 Oct 2009 18:05:18 +0000 Subject: 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 --- chrome/browser/dom_ui/new_tab_ui_uitest.cc | 48 ++++++++++++++++++++++++++++++ chrome/chrome.gyp | 1 + 2 files changed, 49 insertions(+) create mode 100644 chrome/browser/dom_ui/new_tab_ui_uitest.cc 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 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 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); +} diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index c62525b..80f942b 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -4074,6 +4074,7 @@ 'app/chrome_main_uitest.cc', 'browser/browser_encoding_uitest.cc', 'browser/browser_uitest.cc', + 'browser/dom_ui/new_tab_ui_uitest.cc', 'browser/download/download_uitest.cc', 'browser/download/save_page_uitest.cc', 'browser/errorpage_uitest.cc', -- cgit v1.1