| 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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { | 237 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { |
| 238 // Create a new browser with using the incognito profile. | 238 // Create a new browser with using the incognito profile. |
| 239 Browser* incognito = | 239 Browser* incognito = |
| 240 Browser::Create(browser()->profile()->GetOffTheRecordProfile()); | 240 Browser::Create(browser()->profile()->GetOffTheRecordProfile()); |
| 241 AddBlankTabAndShow(incognito); | 241 AddBlankTabAndShow(incognito); |
| 242 return incognito; | 242 return incognito; |
| 243 } | 243 } |
| 244 | 244 |
| 245 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 245 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 246 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 246 Browser* browser = Browser::CreateWithParams( |
| 247 Browser::CreateParams(Browser::TYPE_POPUP, profile)); |
| 247 AddBlankTabAndShow(browser); | 248 AddBlankTabAndShow(browser); |
| 248 return browser; | 249 return browser; |
| 249 } | 250 } |
| 250 | 251 |
| 251 Browser* InProcessBrowserTest::CreateBrowserForApp( | 252 Browser* InProcessBrowserTest::CreateBrowserForApp( |
| 252 const std::string& app_name, | 253 const std::string& app_name, |
| 253 Profile* profile) { | 254 Profile* profile) { |
| 254 Browser* browser = Browser::CreateForApp( | 255 Browser* browser = Browser::CreateWithParams( |
| 255 Browser::TYPE_POPUP, | 256 Browser::CreateParams::CreateForApp( |
| 256 app_name, | 257 Browser::TYPE_POPUP, app_name, gfx::Rect(), profile)); |
| 257 gfx::Rect(), | |
| 258 profile); | |
| 259 AddBlankTabAndShow(browser); | 258 AddBlankTabAndShow(browser); |
| 260 return browser; | 259 return browser; |
| 261 } | 260 } |
| 262 | 261 |
| 263 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 262 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
| 264 ui_test_utils::WindowedNotificationObserver observer( | 263 ui_test_utils::WindowedNotificationObserver observer( |
| 265 content::NOTIFICATION_LOAD_STOP, | 264 content::NOTIFICATION_LOAD_STOP, |
| 266 content::NotificationService::AllSources()); | 265 content::NotificationService::AllSources()); |
| 267 browser->AddSelectedTabWithURL( | 266 browser->AddSelectedTabWithURL( |
| 268 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); | 267 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (BrowserList::size() == 0) | 344 if (BrowserList::size() == 0) |
| 346 return; | 345 return; |
| 347 | 346 |
| 348 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 347 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 349 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 348 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 350 // shut down properly. | 349 // shut down properly. |
| 351 MessageLoopForUI::current()->PostTask(FROM_HERE, | 350 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 352 base::Bind(&BrowserList::AttemptExit)); | 351 base::Bind(&BrowserList::AttemptExit)); |
| 353 ui_test_utils::RunMessageLoop(); | 352 ui_test_utils::RunMessageLoop(); |
| 354 } | 353 } |
| OLD | NEW |