OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/gfx/rect.h" | 6 #include "base/gfx/rect.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/perftimer.h" | 8 #include "base/perftimer.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack()); | 56 set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack()); |
57 | 57 |
58 TimeDelta timings[kNumCycles]; | 58 TimeDelta timings[kNumCycles]; |
59 for (int i = 0; i < kNumCycles; ++i) { | 59 for (int i = 0; i < kNumCycles; ++i) { |
60 UITest::SetUp(); | 60 UITest::SetUp(); |
61 | 61 |
62 // Switch to the "new tab" tab, which should be any new tab after the | 62 // Switch to the "new tab" tab, which should be any new tab after the |
63 // first (the first is about:blank). | 63 // first (the first is about:blank). |
64 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 64 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
65 ASSERT_TRUE(window.get()); | 65 ASSERT_TRUE(window.get()); |
| 66 |
| 67 // We resize the window so that we hit the normal layout of the NTP and |
| 68 // not the small layout mode. |
| 69 #if defined(OS_WIN) |
| 70 // TODO(port): SetBounds returns false when not implemented. |
| 71 // It is OK to comment out the resize since it will still be useful to test the |
| 72 // default size of the window. |
66 ASSERT_TRUE(window->GetWindow().get()->SetBounds(gfx::Rect(1000, 1000))); | 73 ASSERT_TRUE(window->GetWindow().get()->SetBounds(gfx::Rect(1000, 1000))); |
| 74 #endif |
67 int tab_count = -1; | 75 int tab_count = -1; |
68 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 76 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
69 ASSERT_EQ(1, tab_count); | 77 ASSERT_EQ(1, tab_count); |
70 | 78 |
71 // Hit ctl-t and wait for the tab to load. | 79 // Hit ctl-t and wait for the tab to load. |
72 window->ApplyAccelerator(IDC_NEW_TAB); | 80 window->ApplyAccelerator(IDC_NEW_TAB); |
73 ASSERT_TRUE(window->WaitForTabCountToBecome(2, 5000)); | 81 ASSERT_TRUE(window->WaitForTabCountToBecome(2, 5000)); |
74 int load_time; | 82 int load_time; |
75 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); | 83 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
76 timings[i] = TimeDelta::FromMilliseconds(load_time); | 84 timings[i] = TimeDelta::FromMilliseconds(load_time); |
(...skipping 17 matching lines...) Expand all Loading... |
94 // TODO(pamg): run these tests with a reference build? | 102 // TODO(pamg): run these tests with a reference build? |
95 TEST_F(NewTabUIStartupTest, PerfCold) { | 103 TEST_F(NewTabUIStartupTest, PerfCold) { |
96 RunStartupTest("tab_cold", false /* cold */, true /* important */); | 104 RunStartupTest("tab_cold", false /* cold */, true /* important */); |
97 } | 105 } |
98 | 106 |
99 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { | 107 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { |
100 RunStartupTest("tab_warm", true /* warm */, false /* not important */); | 108 RunStartupTest("tab_warm", true /* warm */, false /* not important */); |
101 } | 109 } |
102 | 110 |
103 } // namespace | 111 } // namespace |
OLD | NEW |