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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 AddTabAtIndexToBrowser(browser(), index, url, transition); | 230 AddTabAtIndexToBrowser(browser(), index, url, transition); |
231 } | 231 } |
232 | 232 |
233 bool InProcessBrowserTest::SetUpUserDataDirectory() { | 233 bool InProcessBrowserTest::SetUpUserDataDirectory() { |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 // Creates a browser with a single tab (about:blank), waits for the tab to | 237 // Creates a browser with a single tab (about:blank), waits for the tab to |
238 // finish loading and shows the browser. | 238 // finish loading and shows the browser. |
239 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { | 239 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { |
240 Browser* browser = Browser::Create(profile); | 240 Browser* browser = new Browser(Browser::CreateParams(profile)); |
241 AddBlankTabAndShow(browser); | 241 AddBlankTabAndShow(browser); |
242 return browser; | 242 return browser; |
243 } | 243 } |
244 | 244 |
245 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { | 245 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { |
246 // Create a new browser with using the incognito profile. | 246 // Create a new browser with using the incognito profile. |
247 Browser* incognito = | 247 Browser* incognito = new Browser( |
248 Browser::Create(browser()->profile()->GetOffTheRecordProfile()); | 248 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile())); |
249 AddBlankTabAndShow(incognito); | 249 AddBlankTabAndShow(incognito); |
250 return incognito; | 250 return incognito; |
251 } | 251 } |
252 | 252 |
253 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 253 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
254 Browser* browser = Browser::CreateWithParams( | 254 Browser* browser = |
255 Browser::CreateParams(Browser::TYPE_POPUP, profile)); | 255 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile)); |
256 AddBlankTabAndShow(browser); | 256 AddBlankTabAndShow(browser); |
257 return browser; | 257 return browser; |
258 } | 258 } |
259 | 259 |
260 Browser* InProcessBrowserTest::CreateBrowserForApp( | 260 Browser* InProcessBrowserTest::CreateBrowserForApp( |
261 const std::string& app_name, | 261 const std::string& app_name, |
262 Profile* profile) { | 262 Profile* profile) { |
263 Browser* browser = Browser::CreateWithParams( | 263 Browser* browser = new Browser( |
264 Browser::CreateParams::CreateForApp( | 264 Browser::CreateParams::CreateForApp( |
265 Browser::TYPE_POPUP, app_name, gfx::Rect(), profile)); | 265 Browser::TYPE_POPUP, app_name, gfx::Rect(), profile)); |
266 AddBlankTabAndShow(browser); | 266 AddBlankTabAndShow(browser); |
267 return browser; | 267 return browser; |
268 } | 268 } |
269 | 269 |
270 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 270 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
271 content::WindowedNotificationObserver observer( | 271 content::WindowedNotificationObserver observer( |
272 content::NOTIFICATION_LOAD_STOP, | 272 content::NOTIFICATION_LOAD_STOP, |
273 content::NotificationService::AllSources()); | 273 content::NotificationService::AllSources()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // On the Mac, this eventually reaches | 389 // On the Mac, this eventually reaches |
390 // -[BrowserWindowController windowWillClose:], which will post a deferred | 390 // -[BrowserWindowController windowWillClose:], which will post a deferred |
391 // -autorelease on itself to ultimately destroy the Browser object. The line | 391 // -autorelease on itself to ultimately destroy the Browser object. The line |
392 // below is necessary to pump these pending messages to ensure all Browsers | 392 // below is necessary to pump these pending messages to ensure all Browsers |
393 // get deleted. | 393 // get deleted. |
394 ui_test_utils::RunAllPendingInMessageLoop(); | 394 ui_test_utils::RunAllPendingInMessageLoop(); |
395 delete autorelease_pool_; | 395 delete autorelease_pool_; |
396 autorelease_pool_ = NULL; | 396 autorelease_pool_ = NULL; |
397 #endif | 397 #endif |
398 } | 398 } |
OLD | NEW |