diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 16:11:19 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 16:11:19 +0000 |
commit | 75c8ff7442b58012b24265fc76668fb04b475bae (patch) | |
tree | 3145fe928113d1bc537691efa335d7164c94ff7e /chrome/test | |
parent | 4e474231c1e813aee06704812685b1e74110bc91 (diff) | |
download | chromium_src-75c8ff7442b58012b24265fc76668fb04b475bae.zip chromium_src-75c8ff7442b58012b24265fc76668fb04b475bae.tar.gz chromium_src-75c8ff7442b58012b24265fc76668fb04b475bae.tar.bz2 |
Makes pinned tab service save pinned tabs if you close a normal
browser and there are only non-normal browsers open.
BUG=40293
TEST=see bug, also covered by unit test
R=ben@chromium.org,jcivelli@chromium.org
Review URL: http://codereview.chromium.org/6722008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/browser_with_test_window_test.cc | 25 | ||||
-rw-r--r-- | chrome/test/browser_with_test_window_test.h | 9 |
2 files changed, 24 insertions, 10 deletions
diff --git a/chrome/test/browser_with_test_window_test.cc b/chrome/test/browser_with_test_window_test.cc index db0654a..df70a7e 100644 --- a/chrome/test/browser_with_test_window_test.cc +++ b/chrome/test/browser_with_test_window_test.cc @@ -32,9 +32,7 @@ BrowserWithTestWindowTest::BrowserWithTestWindowTest() void BrowserWithTestWindowTest::SetUp() { TestingBrowserProcessTest::SetUp(); - // NOTE: I have a feeling we're going to want virtual methods for creating - // these, as such they're in SetUp instead of the constructor. - profile_.reset(new TestingProfile()); + profile_.reset(CreateProfile()); content::GetContentClient()->set_browser(&browser_client_); browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); window_.reset(new TestBrowserWindow(browser())); @@ -42,14 +40,9 @@ void BrowserWithTestWindowTest::SetUp() { } BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { - // Make sure we close all tabs, otherwise Browser isn't happy in its - // destructor. - browser()->CloseAllTabs(); - // A Task is leaked if we don't destroy everything, then run the message // loop. - browser_.reset(NULL); - window_.reset(NULL); + DestroyBrowser(); profile_.reset(NULL); MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); @@ -107,3 +100,17 @@ void BrowserWithTestWindowTest::NavigateAndCommit( void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); } + +void BrowserWithTestWindowTest::DestroyBrowser() { + if (!browser_.get()) + return; + // Make sure we close all tabs, otherwise Browser isn't happy in its + // destructor. + browser()->CloseAllTabs(); + browser_.reset(NULL); + window_.reset(NULL); +} + +TestingProfile* BrowserWithTestWindowTest::CreateProfile() { + return new TestingProfile(); +} diff --git a/chrome/test/browser_with_test_window_test.h b/chrome/test/browser_with_test_window_test.h index 2340585..0cc4711 100644 --- a/chrome/test/browser_with_test_window_test.h +++ b/chrome/test/browser_with_test_window_test.h @@ -87,8 +87,15 @@ class BrowserWithTestWindowTest : public TestingBrowserProcessTest { // Navigates the current tab. This is a wrapper around NavigateAndCommit. void NavigateAndCommitActiveTab(const GURL& url); - private: + protected: + // Destroys the browser and window created by this class. This is invoked from + // the destructor. + void DestroyBrowser(); + // Creates the profile used by this test. The caller owners the return value. + virtual TestingProfile* CreateProfile(); + + private: // We need to create a MessageLoop, otherwise a bunch of things fails. MessageLoopForUI ui_loop_; BrowserThread ui_thread_; |