| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/test/automation/browser_proxy.h" | 8 #include "chrome/test/automation/browser_proxy.h" |
| 9 #include "chrome/test/automation/tab_proxy.h" | 9 #include "chrome/test/automation/tab_proxy.h" |
| 10 #include "chrome/test/automation/window_proxy.h" | 10 #include "chrome/test/automation/window_proxy.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Blank thumbnails on the NTP have the class 'filler' applied to the div. | 39 // Blank thumbnails on the NTP have the class 'filler' applied to the div. |
| 40 // If all the thumbnails load, there should be no div's with 'filler'. | 40 // If all the thumbnails load, there should be no div's with 'filler'. |
| 41 scoped_refptr<TabProxy> tab = window->GetActiveTab(); | 41 scoped_refptr<TabProxy> tab = window->GetActiveTab(); |
| 42 int filler_thumbnails_count = -1; | 42 int filler_thumbnails_count = -1; |
| 43 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", | 43 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", |
| 44 L"window.domAutomationController.send(" | 44 L"window.domAutomationController.send(" |
| 45 L"document.getElementsByClassName('filler').length)", | 45 L"document.getElementsByClassName('filler').length)", |
| 46 &filler_thumbnails_count)); | 46 &filler_thumbnails_count)); |
| 47 EXPECT_EQ(0, filler_thumbnails_count); | 47 EXPECT_EQ(0, filler_thumbnails_count); |
| 48 } | 48 } |
| 49 |
| 50 TEST_F(NewTabUITest, ChromeInternalLoadsNTP) { |
| 51 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 52 ASSERT_TRUE(window.get()); |
| 53 |
| 54 int tab_count = -1; |
| 55 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 56 ASSERT_EQ(1, tab_count); |
| 57 |
| 58 // Go to the "new tab page" using its old url, rather than chrome://newtab. |
| 59 scoped_refptr<TabProxy> tab = window->GetTab(0); |
| 60 tab->NavigateToURLAsync(GURL("chrome-internal:")); |
| 61 int load_time; |
| 62 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
| 63 |
| 64 // Ensure there are some thumbnails loaded in the page. |
| 65 int thumbnails_count = -1; |
| 66 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", |
| 67 L"window.domAutomationController.send(" |
| 68 L"document.getElementsByClassName('thumbnail-container').length)", |
| 69 &thumbnails_count)); |
| 70 EXPECT_GT(thumbnails_count, 0); |
| 71 } |
| 72 |
| OLD | NEW |