| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mac/scoped_nsautorelease_pool.h" | 7 #include "base/mac/scoped_nsautorelease_pool.h" |
| 8 #include "chrome/browser/devtools/devtools_window.h" | 8 #include "chrome/browser/devtools/devtools_window.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return browser; | 39 return browser; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Creates a browser with a single tab (about:blank), waits for the tab to | 42 // Creates a browser with a single tab (about:blank), waits for the tab to |
| 43 // finish loading and shows the browser. | 43 // finish loading and shows the browser. |
| 44 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { | 44 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { |
| 45 // Making a browser window can cause AppKit to throw objects into the | 45 // Making a browser window can cause AppKit to throw objects into the |
| 46 // autorelease pool. Flush the pool when this function returns. | 46 // autorelease pool. Flush the pool when this function returns. |
| 47 base::mac::ScopedNSAutoreleasePool pool; | 47 base::mac::ScopedNSAutoreleasePool pool; |
| 48 | 48 |
| 49 Browser* browser = new Browser(Browser::CreateParams(profile)); | 49 Browser* browser = new Browser(Browser::CreateParams(profile, true)); |
| 50 AddBlankTabAndShow(browser); | 50 AddBlankTabAndShow(browser); |
| 51 return browser; | 51 return browser; |
| 52 } | 52 } |
| 53 | 53 |
| 54 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { | 54 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { |
| 55 // Making a browser window can cause AppKit to throw objects into the | 55 // Making a browser window can cause AppKit to throw objects into the |
| 56 // autorelease pool. Flush the pool when this function returns. | 56 // autorelease pool. Flush the pool when this function returns. |
| 57 base::mac::ScopedNSAutoreleasePool pool; | 57 base::mac::ScopedNSAutoreleasePool pool; |
| 58 | 58 |
| 59 // Create a new browser with using the incognito profile. | 59 // Create a new browser with using the incognito profile. |
| 60 Browser* incognito = new Browser( | 60 Browser* incognito = new Browser(Browser::CreateParams( |
| 61 Browser::CreateParams(browser()->profile()->GetOffTheRecordProfile())); | 61 browser()->profile()->GetOffTheRecordProfile(), true)); |
| 62 AddBlankTabAndShow(incognito); | 62 AddBlankTabAndShow(incognito); |
| 63 return incognito; | 63 return incognito; |
| 64 } | 64 } |
| 65 | 65 |
| 66 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 66 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 67 // Making a browser window can cause AppKit to throw objects into the | 67 // Making a browser window can cause AppKit to throw objects into the |
| 68 // autorelease pool. Flush the pool when this function returns. | 68 // autorelease pool. Flush the pool when this function returns. |
| 69 base::mac::ScopedNSAutoreleasePool pool; | 69 base::mac::ScopedNSAutoreleasePool pool; |
| 70 | 70 |
| 71 Browser* browser = | 71 Browser* browser = |
| 72 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile)); | 72 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile, true)); |
| 73 AddBlankTabAndShow(browser); | 73 AddBlankTabAndShow(browser); |
| 74 return browser; | 74 return browser; |
| 75 } | 75 } |
| 76 | 76 |
| 77 Browser* InProcessBrowserTest::CreateBrowserForApp( | 77 Browser* InProcessBrowserTest::CreateBrowserForApp( |
| 78 const std::string& app_name, | 78 const std::string& app_name, |
| 79 Profile* profile) { | 79 Profile* profile) { |
| 80 // Making a browser window can cause AppKit to throw objects into the | 80 // Making a browser window can cause AppKit to throw objects into the |
| 81 // autorelease pool. Flush the pool when this function returns. | 81 // autorelease pool. Flush the pool when this function returns. |
| 82 base::mac::ScopedNSAutoreleasePool pool; | 82 base::mac::ScopedNSAutoreleasePool pool; |
| 83 | 83 |
| 84 Browser* browser = new Browser(Browser::CreateParams::CreateForApp( | 84 Browser* browser = new Browser(Browser::CreateParams::CreateForApp( |
| 85 app_name, false /* trusted_source */, gfx::Rect(), profile)); | 85 app_name, false /* trusted_source */, gfx::Rect(), profile, true)); |
| 86 AddBlankTabAndShow(browser); | 86 AddBlankTabAndShow(browser); |
| 87 return browser; | 87 return browser; |
| 88 } | 88 } |
| OLD | NEW |