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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 file_util::UpOneDirectory(&path_prefix_); | 32 file_util::UpOneDirectory(&path_prefix_); |
33 file_util::AppendToPath(&path_prefix_, L"data"); | 33 file_util::AppendToPath(&path_prefix_, L"data"); |
34 file_util::AppendToPath(&path_prefix_, L"tab_switching"); | 34 file_util::AppendToPath(&path_prefix_, L"tab_switching"); |
35 path_prefix_ += FilePath::kSeparators[0]; | 35 path_prefix_ += FilePath::kSeparators[0]; |
36 | 36 |
37 show_window_ = true; | 37 show_window_ = true; |
38 } | 38 } |
39 | 39 |
40 void RunTabSwitchingUITest() { | 40 void RunTabSwitchingUITest() { |
41 // Create a browser proxy. | 41 // Create a browser proxy. |
42 browser_proxy_.reset(automation()->GetBrowserWindow(0)); | 42 browser_proxy_ = automation()->GetBrowserWindow(0); |
43 | 43 |
44 // Open all the tabs. | 44 // Open all the tabs. |
45 int initial_tab_count = 0; | 45 int initial_tab_count = 0; |
46 ASSERT_TRUE(browser_proxy_->GetTabCount(&initial_tab_count)); | 46 ASSERT_TRUE(browser_proxy_->GetTabCount(&initial_tab_count)); |
47 int new_tab_count = OpenTabs(); | 47 int new_tab_count = OpenTabs(); |
48 ASSERT_TRUE(browser_proxy_->WaitForTabCountToBecome( | 48 ASSERT_TRUE(browser_proxy_->WaitForTabCountToBecome( |
49 initial_tab_count + new_tab_count, 10000)); | 49 initial_tab_count + new_tab_count, 10000)); |
50 | 50 |
51 // Switch linearly between tabs. | 51 // Switch linearly between tabs. |
52 browser_proxy_->ActivateTab(0); | 52 browser_proxy_->ActivateTab(0); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 file_name = file_name.AppendASCII("index.html"); | 121 file_name = file_name.AppendASCII("index.html"); |
122 browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); | 122 browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); |
123 number_of_new_tabs_opened++; | 123 number_of_new_tabs_opened++; |
124 } | 124 } |
125 | 125 |
126 return number_of_new_tabs_opened; | 126 return number_of_new_tabs_opened; |
127 } | 127 } |
128 | 128 |
129 std::wstring path_prefix_; | 129 std::wstring path_prefix_; |
130 int number_of_tabs_to_open_; | 130 int number_of_tabs_to_open_; |
131 scoped_ptr<BrowserProxy> browser_proxy_; | 131 scoped_refptr<BrowserProxy> browser_proxy_; |
132 | 132 |
133 private: | 133 private: |
134 DISALLOW_EVIL_CONSTRUCTORS(TabSwitchingUITest); | 134 DISALLOW_EVIL_CONSTRUCTORS(TabSwitchingUITest); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace | 137 } // namespace |
138 | 138 |
139 TEST_F(TabSwitchingUITest, GenerateTabSwitchStats) { | 139 TEST_F(TabSwitchingUITest, GenerateTabSwitchStats) { |
140 RunTabSwitchingUITest(); | 140 RunTabSwitchingUITest(); |
141 } | 141 } |
OLD | NEW |