| 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/prefs/pref_registry_simple.h" | |
| 9 #include "base/prefs/testing_pref_service.h" | |
| 10 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/sessions/session_service_factory.h" | 12 #include "chrome/browser/sessions/session_service_factory.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/test/base/browser_with_test_window_test.h" | 15 #include "chrome/test/base/browser_with_test_window_test.h" |
| 18 #include "chrome/test/base/scoped_testing_local_state.h" | 16 #include "chrome/test/base/scoped_testing_local_state.h" |
| 19 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 20 #include "components/infobars/core/infobar.h" | 18 #include "components/infobars/core/infobar.h" |
| 19 #include "components/prefs/pref_registry_simple.h" |
| 20 #include "components/prefs/testing_pref_service.h" |
| 21 | 21 |
| 22 class SessionCrashedInfoBarDelegateUnitTest : public BrowserWithTestWindowTest { | 22 class SessionCrashedInfoBarDelegateUnitTest : public BrowserWithTestWindowTest { |
| 23 public: | 23 public: |
| 24 void SetUp() override { | 24 void SetUp() override { |
| 25 static_cast<TestingBrowserProcess*>(g_browser_process) | 25 static_cast<TestingBrowserProcess*>(g_browser_process) |
| 26 ->SetLocalState(&pref_service); | 26 ->SetLocalState(&pref_service); |
| 27 chrome::RegisterLocalState(pref_service.registry()); | 27 chrome::RegisterLocalState(pref_service.registry()); |
| 28 | 28 |
| 29 // This needs to be called after the local state is set, because it will | 29 // This needs to be called after the local state is set, because it will |
| 30 // create a browser which will try to read from the local state. | 30 // create a browser which will try to read from the local state. |
| (...skipping 61 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 |