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/path_service.h" | 7 #include "base/path_service.h" |
7 #include "base/perftimer.h" | 8 #include "base/perftimer.h" |
8 #include "base/time.h" | 9 #include "base/time.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
11 #include "chrome/test/automation/browser_proxy.h" | 12 #include "chrome/test/automation/browser_proxy.h" |
| 13 #include "chrome/test/automation/window_proxy.h" |
12 #include "chrome/test/ui/ui_test.h" | 14 #include "chrome/test/ui/ui_test.h" |
13 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
14 | 16 |
15 using base::TimeDelta; | 17 using base::TimeDelta; |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 // Returns the directory name where the "typical" user data is that we use for | 21 // Returns the directory name where the "typical" user data is that we use for |
20 // testing. | 22 // testing. |
21 FilePath ComputeTypicalUserDataSource() { | 23 FilePath ComputeTypicalUserDataSource() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack()); | 56 set_template_user_data(ComputeTypicalUserDataSource().ToWStringHack()); |
55 | 57 |
56 TimeDelta timings[kNumCycles]; | 58 TimeDelta timings[kNumCycles]; |
57 for (int i = 0; i < kNumCycles; ++i) { | 59 for (int i = 0; i < kNumCycles; ++i) { |
58 UITest::SetUp(); | 60 UITest::SetUp(); |
59 | 61 |
60 // 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 |
61 // first (the first is about:blank). | 63 // first (the first is about:blank). |
62 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 64 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
63 ASSERT_TRUE(window.get()); | 65 ASSERT_TRUE(window.get()); |
| 66 ASSERT_TRUE(window->GetWindow().get()->SetBounds(gfx::Rect(1000, 1000))); |
64 int tab_count = -1; | 67 int tab_count = -1; |
65 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 68 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
66 ASSERT_EQ(1, tab_count); | 69 ASSERT_EQ(1, tab_count); |
67 | 70 |
68 // Hit ctl-t and wait for the tab to load. | 71 // Hit ctl-t and wait for the tab to load. |
69 window->ApplyAccelerator(IDC_NEW_TAB); | 72 window->ApplyAccelerator(IDC_NEW_TAB); |
70 ASSERT_TRUE(window->WaitForTabCountToBecome(2, 5000)); | 73 ASSERT_TRUE(window->WaitForTabCountToBecome(2, 5000)); |
71 int load_time; | 74 int load_time; |
72 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); | 75 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
73 timings[i] = TimeDelta::FromMilliseconds(load_time); | 76 timings[i] = TimeDelta::FromMilliseconds(load_time); |
(...skipping 17 matching lines...) Expand all Loading... |
91 // TODO(pamg): run these tests with a reference build? | 94 // TODO(pamg): run these tests with a reference build? |
92 TEST_F(NewTabUIStartupTest, PerfCold) { | 95 TEST_F(NewTabUIStartupTest, PerfCold) { |
93 RunStartupTest("tab_cold", false /* cold */, true /* important */); | 96 RunStartupTest("tab_cold", false /* cold */, true /* important */); |
94 } | 97 } |
95 | 98 |
96 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { | 99 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { |
97 RunStartupTest("tab_warm", true /* warm */, false /* not important */); | 100 RunStartupTest("tab_warm", true /* warm */, false /* not important */); |
98 } | 101 } |
99 | 102 |
100 } // namespace | 103 } // namespace |
OLD | NEW |