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 "base/time.h" | 7 #include "base/time.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // draw graphs for page cycler Tab Switching Performance. | 26 // draw graphs for page cycler Tab Switching Performance. |
27 // Usage Flags: -enable-logging -dump-histograms-on-exit | 27 // Usage Flags: -enable-logging -dump-histograms-on-exit |
28 class TabSwitchingUITest : public UITest { | 28 class TabSwitchingUITest : public UITest { |
29 public: | 29 public: |
30 TabSwitchingUITest() { | 30 TabSwitchingUITest() { |
31 PathService::Get(base::DIR_EXE, &path_prefix_); | 31 PathService::Get(base::DIR_EXE, &path_prefix_); |
32 file_util::UpOneDirectory(&path_prefix_); | 32 file_util::UpOneDirectory(&path_prefix_); |
33 file_util::UpOneDirectory(&path_prefix_); | 33 file_util::UpOneDirectory(&path_prefix_); |
34 file_util::AppendToPath(&path_prefix_, L"data"); | 34 file_util::AppendToPath(&path_prefix_, L"data"); |
35 file_util::AppendToPath(&path_prefix_, L"tab_switching"); | 35 file_util::AppendToPath(&path_prefix_, L"tab_switching"); |
36 path_prefix_ += file_util::kPathSeparator; | 36 path_prefix_ += FilePath::kSeparators[0]; |
37 | 37 |
38 show_window_ = true; | 38 show_window_ = true; |
39 } | 39 } |
40 | 40 |
41 void RunTabSwitchingUITest() { | 41 void RunTabSwitchingUITest() { |
42 // Create a browser proxy. | 42 // Create a browser proxy. |
43 browser_proxy_.reset(automation()->GetBrowserWindow(0)); | 43 browser_proxy_.reset(automation()->GetBrowserWindow(0)); |
44 | 44 |
45 // Open all the tabs. | 45 // Open all the tabs. |
46 int initial_tab_count = 0; | 46 int initial_tab_count = 0; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 static const wchar_t* files[] = { L"espn.go.com", L"bugzilla.mozilla.org", | 113 static const wchar_t* files[] = { L"espn.go.com", L"bugzilla.mozilla.org", |
114 L"news.cnet.com", L"www.amazon.com", | 114 L"news.cnet.com", L"www.amazon.com", |
115 L"kannada.chakradeo.net", L"allegro.pl", | 115 L"kannada.chakradeo.net", L"allegro.pl", |
116 L"ml.wikipedia.org", L"www.bbc.co.uk", | 116 L"ml.wikipedia.org", L"www.bbc.co.uk", |
117 L"126.com", L"www.altavista.com"}; | 117 L"126.com", L"www.altavista.com"}; |
118 int number_of_new_tabs_opened = 0; | 118 int number_of_new_tabs_opened = 0; |
119 std::wstring file_name; | 119 std::wstring file_name; |
120 for (int i = 0; i < arraysize(files); ++i) { | 120 for (int i = 0; i < arraysize(files); ++i) { |
121 file_name = path_prefix_; | 121 file_name = path_prefix_; |
122 file_name += files[i]; | 122 file_name += files[i]; |
123 file_name += file_util::kPathSeparator; | 123 file_name += FilePath::kSeparators[0]; |
124 file_name += L"index.html"; | 124 file_name += L"index.html"; |
125 browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); | 125 browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); |
126 number_of_new_tabs_opened++; | 126 number_of_new_tabs_opened++; |
127 } | 127 } |
128 | 128 |
129 return number_of_new_tabs_opened; | 129 return number_of_new_tabs_opened; |
130 } | 130 } |
131 | 131 |
132 std::wstring path_prefix_; | 132 std::wstring path_prefix_; |
133 int number_of_tabs_to_open_; | 133 int number_of_tabs_to_open_; |
134 scoped_ptr<BrowserProxy> browser_proxy_; | 134 scoped_ptr<BrowserProxy> browser_proxy_; |
135 | 135 |
136 private: | 136 private: |
137 DISALLOW_EVIL_CONSTRUCTORS(TabSwitchingUITest); | 137 DISALLOW_EVIL_CONSTRUCTORS(TabSwitchingUITest); |
138 }; | 138 }; |
139 | 139 |
140 } // namespace | 140 } // namespace |
141 | 141 |
142 TEST_F(TabSwitchingUITest, GenerateTabSwitchStats) { | 142 TEST_F(TabSwitchingUITest, GenerateTabSwitchStats) { |
143 RunTabSwitchingUITest(); | 143 RunTabSwitchingUITest(); |
144 } | 144 } |
145 | 145 |
OLD | NEW |