| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/default_browser_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/default_browser_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void EnableStickyDefaultBrowserPrompt() { | 72 void EnableStickyDefaultBrowserPrompt() { |
| 73 base::FeatureList::ClearInstanceForTesting(); | 73 base::FeatureList::ClearInstanceForTesting(); |
| 74 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 74 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 75 feature_list->InitializeFromCommandLine(kStickyDefaultBrowserPrompt.name, | 75 feature_list->InitializeFromCommandLine(kStickyDefaultBrowserPrompt.name, |
| 76 std::string()); | 76 std::string()); |
| 77 base::FeatureList::SetInstance(std::move(feature_list)); | 77 base::FeatureList::SetInstance(std::move(feature_list)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void AddDefaultBrowserInfoBar() { | 80 void AddDefaultBrowserInfoBar() { |
| 81 infobar_service_->AddInfoBar(infobar_service_->CreateConfirmInfoBar( | 81 infobar_service_->AddInfoBar(infobar_service_->CreateConfirmInfoBar( |
| 82 base::WrapUnique(new FakeDefaultBrowserInfoBarDelegate()))); | 82 base::MakeUnique<FakeDefaultBrowserInfoBarDelegate>())); |
| 83 } | 83 } |
| 84 | 84 |
| 85 InfoBarService* infobar_service() { return infobar_service_; } | 85 InfoBarService* infobar_service() { return infobar_service_; } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 // The DefaultBrowserWorker requires a FILE thread. Also provides a | 88 // The DefaultBrowserWorker requires a FILE thread. Also provides a |
| 89 // SingleThreadTaskRunner for the test profile and the default browser prompt. | 89 // SingleThreadTaskRunner for the test profile and the default browser prompt. |
| 90 content::TestBrowserThreadBundle thread_bundle; | 90 content::TestBrowserThreadBundle thread_bundle; |
| 91 | 91 |
| 92 // Required to get an InfoBarService. | 92 // Required to get an InfoBarService. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 EXPECT_EQ(1U, infobar_service()->infobar_count()); | 139 EXPECT_EQ(1U, infobar_service()->infobar_count()); |
| 140 | 140 |
| 141 // Spin the message loop to allow the FakeDefaultBrowserWorker to complete, | 141 // Spin the message loop to allow the FakeDefaultBrowserWorker to complete, |
| 142 // which should destroy the infobar. | 142 // which should destroy the infobar. |
| 143 base::RunLoop().RunUntilIdle(); | 143 base::RunLoop().RunUntilIdle(); |
| 144 EXPECT_EQ(0U, infobar_service()->infobar_count()); | 144 EXPECT_EQ(0U, infobar_service()->infobar_count()); |
| 145 } | 145 } |
| 146 #endif // defined(OS_WIN) | 146 #endif // defined(OS_WIN) |
| 147 | 147 |
| 148 } // namespace chrome | 148 } // namespace chrome |
| OLD | NEW |