OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 #if defined(OS_WIN) | 281 #if defined(OS_WIN) |
282 com_initializer_.reset(); | 282 com_initializer_.reset(); |
283 #endif | 283 #endif |
284 BrowserTestBase::TearDown(); | 284 BrowserTestBase::TearDown(); |
285 } | 285 } |
286 | 286 |
287 void InProcessBrowserTest::AddTabAtIndexToBrowser( | 287 void InProcessBrowserTest::AddTabAtIndexToBrowser( |
288 Browser* browser, | 288 Browser* browser, |
289 int index, | 289 int index, |
290 const GURL& url, | 290 const GURL& url, |
291 content::PageTransition transition) { | 291 ui::PageTransition transition) { |
292 chrome::NavigateParams params(browser, url, transition); | 292 chrome::NavigateParams params(browser, url, transition); |
293 params.tabstrip_index = index; | 293 params.tabstrip_index = index; |
294 params.disposition = NEW_FOREGROUND_TAB; | 294 params.disposition = NEW_FOREGROUND_TAB; |
295 chrome::Navigate(¶ms); | 295 chrome::Navigate(¶ms); |
296 | 296 |
297 content::WaitForLoadStop(params.target_contents); | 297 content::WaitForLoadStop(params.target_contents); |
298 } | 298 } |
299 | 299 |
300 void InProcessBrowserTest::AddTabAtIndex( | 300 void InProcessBrowserTest::AddTabAtIndex( |
301 int index, | 301 int index, |
302 const GURL& url, | 302 const GURL& url, |
303 content::PageTransition transition) { | 303 ui::PageTransition transition) { |
304 AddTabAtIndexToBrowser(browser(), index, url, transition); | 304 AddTabAtIndexToBrowser(browser(), index, url, transition); |
305 } | 305 } |
306 | 306 |
307 bool InProcessBrowserTest::SetUpUserDataDirectory() { | 307 bool InProcessBrowserTest::SetUpUserDataDirectory() { |
308 return true; | 308 return true; |
309 } | 309 } |
310 | 310 |
311 // Creates a browser with a single tab (about:blank), waits for the tab to | 311 // Creates a browser with a single tab (about:blank), waits for the tab to |
312 // finish loading and shows the browser. | 312 // finish loading and shows the browser. |
313 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { | 313 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { |
(...skipping 30 matching lines...) Expand all Loading... |
344 AddBlankTabAndShow(browser); | 344 AddBlankTabAndShow(browser); |
345 return browser; | 345 return browser; |
346 } | 346 } |
347 | 347 |
348 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 348 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
349 content::WindowedNotificationObserver observer( | 349 content::WindowedNotificationObserver observer( |
350 content::NOTIFICATION_LOAD_STOP, | 350 content::NOTIFICATION_LOAD_STOP, |
351 content::NotificationService::AllSources()); | 351 content::NotificationService::AllSources()); |
352 chrome::AddSelectedTabWithURL(browser, | 352 chrome::AddSelectedTabWithURL(browser, |
353 GURL(url::kAboutBlankURL), | 353 GURL(url::kAboutBlankURL), |
354 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 354 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
355 observer.Wait(); | 355 observer.Wait(); |
356 | 356 |
357 browser->window()->Show(); | 357 browser->window()->Show(); |
358 } | 358 } |
359 | 359 |
360 #if !defined(OS_MACOSX) | 360 #if !defined(OS_MACOSX) |
361 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { | 361 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { |
362 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); | 362 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); |
363 CommandLine::SwitchMap switches = | 363 CommandLine::SwitchMap switches = |
364 CommandLine::ForCurrentProcess()->GetSwitches(); | 364 CommandLine::ForCurrentProcess()->GetSwitches(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // On the Mac, this eventually reaches | 479 // On the Mac, this eventually reaches |
480 // -[BrowserWindowController windowWillClose:], which will post a deferred | 480 // -[BrowserWindowController windowWillClose:], which will post a deferred |
481 // -autorelease on itself to ultimately destroy the Browser object. The line | 481 // -autorelease on itself to ultimately destroy the Browser object. The line |
482 // below is necessary to pump these pending messages to ensure all Browsers | 482 // below is necessary to pump these pending messages to ensure all Browsers |
483 // get deleted. | 483 // get deleted. |
484 content::RunAllPendingInMessageLoop(); | 484 content::RunAllPendingInMessageLoop(); |
485 delete autorelease_pool_; | 485 delete autorelease_pool_; |
486 autorelease_pool_ = NULL; | 486 autorelease_pool_ = NULL; |
487 #endif | 487 #endif |
488 } | 488 } |
OLD | NEW |