OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 "<NEWTAB>", | 206 "<NEWTAB>", |
207 "http://www.google.com/translate_t?hl=en&text=This%20Is%20A%20Test%20Of%20
missspellingsdfdf&sl=en&tl=ja", | 207 "http://www.google.com/translate_t?hl=en&text=This%20Is%20A%20Test%20Of%20
missspellingsdfdf&sl=en&tl=ja", |
208 }; | 208 }; |
209 | 209 |
210 // Record the initial CommitCharge. This is a system-wide measurement, | 210 // Record the initial CommitCharge. This is a system-wide measurement, |
211 // so if other applications are running, they can create variance in this | 211 // so if other applications are running, they can create variance in this |
212 // test. | 212 // test. |
213 size_t start_size = GetSystemCommitCharge(); | 213 size_t start_size = GetSystemCommitCharge(); |
214 | 214 |
215 // Cycle through the URLs. | 215 // Cycle through the URLs. |
216 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 216 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
217 scoped_ptr<TabProxy> tab(window->GetActiveTab()); | 217 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
218 int expected_tab_count = 1; | 218 int expected_tab_count = 1; |
219 for (unsigned counter = 0; counter < arraysize(urls); ++counter) { | 219 for (unsigned counter = 0; counter < arraysize(urls); ++counter) { |
220 std::string url = urls[counter]; | 220 std::string url = urls[counter]; |
221 | 221 |
222 if (url == "<PAUSE>") { // Special command to delay on this page | 222 if (url == "<PAUSE>") { // Special command to delay on this page |
223 PlatformThread::Sleep(2000); | 223 PlatformThread::Sleep(2000); |
224 continue; | 224 continue; |
225 } | 225 } |
226 | 226 |
227 if (url == "<NEWTAB>") { // Special command to create a new tab | 227 if (url == "<NEWTAB>") { // Special command to create a new tab |
228 if (++counter >= arraysize(urls)) | 228 if (++counter >= arraysize(urls)) |
229 continue; // Newtab was specified at end of list. ignore. | 229 continue; // Newtab was specified at end of list. ignore. |
230 | 230 |
231 url = urls[counter]; | 231 url = urls[counter]; |
232 if (GetTabCount() < num_target_tabs) { | 232 if (GetTabCount() < num_target_tabs) { |
233 EXPECT_TRUE(window->AppendTab(GURL(url))); | 233 EXPECT_TRUE(window->AppendTab(GURL(url))); |
234 expected_tab_count++; | 234 expected_tab_count++; |
235 WaitUntilTabCount(expected_tab_count); | 235 WaitUntilTabCount(expected_tab_count); |
236 tab.reset(window->GetActiveTab()); | 236 tab = window->GetActiveTab(); |
237 continue; | 237 continue; |
238 } | 238 } |
239 | 239 |
240 int tab_index = counter % num_target_tabs; // A pseudo-random tab. | 240 int tab_index = counter % num_target_tabs; // A pseudo-random tab. |
241 tab.reset(window->GetTab(tab_index)); | 241 tab = window->GetTab(tab_index); |
242 } | 242 } |
243 | 243 |
244 const int kMaxWaitTime = 5000; | 244 const int kMaxWaitTime = 5000; |
245 bool timed_out = false; | 245 bool timed_out = false; |
246 tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime, | 246 tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime, |
247 &timed_out); | 247 &timed_out); |
248 if (timed_out) | 248 if (timed_out) |
249 printf("warning: %s timed out!\n", urls[counter].c_str()); | 249 printf("warning: %s timed out!\n", urls[counter].c_str()); |
250 | 250 |
251 // TODO(mbelshe): Bug 2953 | 251 // TODO(mbelshe): Bug 2953 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 RunTest("1t", 1); | 424 RunTest("1t", 1); |
425 } | 425 } |
426 | 426 |
427 TEST_F(MemoryTest, FiveTabTest) { | 427 TEST_F(MemoryTest, FiveTabTest) { |
428 RunTest("5t", 5); | 428 RunTest("5t", 5); |
429 } | 429 } |
430 | 430 |
431 TEST_F(MemoryTest, TwelveTabTest) { | 431 TEST_F(MemoryTest, TwelveTabTest) { |
432 RunTest("12t", 12); | 432 RunTest("12t", 12); |
433 } | 433 } |
OLD | NEW |