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 22 matching lines...) Expand all Loading... |
33 // Bring up a new tab page. | 33 // Bring up a new tab page. |
34 window->ApplyAccelerator(IDC_NEW_TAB); | 34 window->ApplyAccelerator(IDC_NEW_TAB); |
35 WaitUntilTabCount(2); | 35 WaitUntilTabCount(2); |
36 int load_time; | 36 int load_time; |
37 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); | 37 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
38 | 38 |
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 const int kWaitDuration = 100; |
44 L"window.domAutomationController.send(" | 44 int wait_time = action_max_timeout_ms(); |
45 L"document.getElementsByClassName('filler').length)", | 45 while (wait_time > 0) { |
46 &filler_thumbnails_count)); | 46 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", |
| 47 L"window.domAutomationController.send(" |
| 48 L"document.getElementsByClassName('filler').length)", |
| 49 &filler_thumbnails_count)); |
| 50 if (filler_thumbnails_count == 0) |
| 51 break; |
| 52 PlatformThread::Sleep(kWaitDuration); |
| 53 wait_time -= kWaitDuration; |
| 54 } |
47 EXPECT_EQ(0, filler_thumbnails_count); | 55 EXPECT_EQ(0, filler_thumbnails_count); |
48 } | 56 } |
OLD | NEW |