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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 AddBlankTabAndShow(incognito); | 236 AddBlankTabAndShow(incognito); |
237 return incognito; | 237 return incognito; |
238 } | 238 } |
239 | 239 |
240 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 240 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
241 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 241 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); |
242 AddBlankTabAndShow(browser); | 242 AddBlankTabAndShow(browser); |
243 return browser; | 243 return browser; |
244 } | 244 } |
245 | 245 |
| 246 Browser* InProcessBrowserTest::CreateBrowserForApp( |
| 247 const std::string& app_name, |
| 248 Profile* profile) { |
| 249 Browser* browser = Browser::CreateForApp( |
| 250 Browser::TYPE_POPUP, |
| 251 app_name, |
| 252 gfx::Rect(), |
| 253 profile); |
| 254 AddBlankTabAndShow(browser); |
| 255 return browser; |
| 256 } |
| 257 |
246 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 258 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
247 ui_test_utils::WindowedNotificationObserver observer( | 259 ui_test_utils::WindowedNotificationObserver observer( |
248 content::NOTIFICATION_LOAD_STOP, | 260 content::NOTIFICATION_LOAD_STOP, |
249 content::NotificationService::AllSources()); | 261 content::NotificationService::AllSources()); |
250 browser->AddSelectedTabWithURL( | 262 browser->AddSelectedTabWithURL( |
251 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); | 263 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); |
252 observer.Wait(); | 264 observer.Wait(); |
253 | 265 |
254 browser->window()->Show(); | 266 browser->window()->Show(); |
255 } | 267 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (BrowserList::size() == 0) | 338 if (BrowserList::size() == 0) |
327 return; | 339 return; |
328 | 340 |
329 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 341 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
330 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 342 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
331 // shut down properly. | 343 // shut down properly. |
332 MessageLoopForUI::current()->PostTask(FROM_HERE, | 344 MessageLoopForUI::current()->PostTask(FROM_HERE, |
333 base::Bind(&BrowserList::AttemptExit)); | 345 base::Bind(&BrowserList::AttemptExit)); |
334 ui_test_utils::RunMessageLoop(); | 346 ui_test_utils::RunMessageLoop(); |
335 } | 347 } |
OLD | NEW |