| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/ui/startup/session_crashed_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ->SetLocalState(&pref_service); | 27 ->SetLocalState(&pref_service); |
| 28 chrome::RegisterLocalState(pref_service.registry()); | 28 chrome::RegisterLocalState(pref_service.registry()); |
| 29 | 29 |
| 30 // This needs to be called after the local state is set, because it will | 30 // This needs to be called after the local state is set, because it will |
| 31 // create a browser which will try to read from the local state. | 31 // create a browser which will try to read from the local state. |
| 32 BrowserWithTestWindowTest::SetUp(); | 32 BrowserWithTestWindowTest::SetUp(); |
| 33 | 33 |
| 34 // Make sure we have a Profile Manager. | 34 // Make sure we have a Profile Manager. |
| 35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 36 TestingBrowserProcess::GetGlobal()->SetProfileManager( | 36 TestingBrowserProcess::GetGlobal()->SetProfileManager( |
| 37 new ProfileManagerWithoutInit(temp_dir_.path())); | 37 new ProfileManagerWithoutInit(temp_dir_.GetPath())); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void TearDown() override { | 40 void TearDown() override { |
| 41 static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL); | 41 static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL); |
| 42 BrowserWithTestWindowTest::TearDown(); | 42 BrowserWithTestWindowTest::TearDown(); |
| 43 | 43 |
| 44 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 44 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 infobar_service = | 92 infobar_service = |
| 93 InfoBarService::FromWebContents(tab_strip->GetWebContentsAt(0)); | 93 InfoBarService::FromWebContents(tab_strip->GetWebContentsAt(0)); |
| 94 EXPECT_EQ(1U, infobar_service->infobar_count()); | 94 EXPECT_EQ(1U, infobar_service->infobar_count()); |
| 95 | 95 |
| 96 // This used to crash. | 96 // This used to crash. |
| 97 infobar->Accept(); | 97 infobar->Accept(); |
| 98 | 98 |
| 99 // Ramp down the test. | 99 // Ramp down the test. |
| 100 tab_strip->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); | 100 tab_strip->CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); |
| 101 } | 101 } |
| OLD | NEW |