| 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/browser/signin/easy_unlock_app_manager.h" | 5 #include "chrome/browser/signin/easy_unlock_app_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const GURL& url) override { | 70 const GURL& url) override { |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); | 75 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 std::unique_ptr<KeyedService> CreateTestProcessManager( | 78 std::unique_ptr<KeyedService> CreateTestProcessManager( |
| 79 content::BrowserContext* context) { | 79 content::BrowserContext* context) { |
| 80 return base::WrapUnique(new TestProcessManager(context)); | 80 return base::MakeUnique<TestProcessManager>(context); |
| 81 } | 81 } |
| 82 | 82 |
| 83 std::unique_ptr<KeyedService> CreateScreenlockPrivateEventRouter( | 83 std::unique_ptr<KeyedService> CreateScreenlockPrivateEventRouter( |
| 84 content::BrowserContext* context) { | 84 content::BrowserContext* context) { |
| 85 return base::WrapUnique( | 85 return base::MakeUnique<extensions::ScreenlockPrivateEventRouter>(context); |
| 86 new extensions::ScreenlockPrivateEventRouter(context)); | |
| 87 } | 86 } |
| 88 | 87 |
| 89 // Observes extension registry for unload and load events (in that order) of an | 88 // Observes extension registry for unload and load events (in that order) of an |
| 90 // extension with the provided extension id. | 89 // extension with the provided extension id. |
| 91 // Used to determine if an extension was reloaded. | 90 // Used to determine if an extension was reloaded. |
| 92 class ExtensionReloadTracker : public extensions::ExtensionRegistryObserver { | 91 class ExtensionReloadTracker : public extensions::ExtensionRegistryObserver { |
| 93 public: | 92 public: |
| 94 ExtensionReloadTracker(Profile* profile, const std::string& extension_id) | 93 ExtensionReloadTracker(Profile* profile, const std::string& extension_id) |
| 95 : profile_(profile), | 94 : profile_(profile), |
| 96 extension_id_(extension_id), | 95 extension_id_(extension_id), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 270 |
| 272 private: | 271 private: |
| 273 EasyUnlockAppEventConsumer* event_consumer_; | 272 EasyUnlockAppEventConsumer* event_consumer_; |
| 274 | 273 |
| 275 DISALLOW_COPY_AND_ASSIGN(TestEventRouter); | 274 DISALLOW_COPY_AND_ASSIGN(TestEventRouter); |
| 276 }; | 275 }; |
| 277 | 276 |
| 278 // TestEventRouter factory function | 277 // TestEventRouter factory function |
| 279 std::unique_ptr<KeyedService> TestEventRouterFactoryFunction( | 278 std::unique_ptr<KeyedService> TestEventRouterFactoryFunction( |
| 280 content::BrowserContext* context) { | 279 content::BrowserContext* context) { |
| 281 return base::WrapUnique( | 280 return base::MakeUnique<TestEventRouter>( |
| 282 new TestEventRouter(static_cast<Profile*>(context), | 281 static_cast<Profile*>(context), extensions::ExtensionPrefs::Get(context)); |
| 283 extensions::ExtensionPrefs::Get(context))); | |
| 284 } | 282 } |
| 285 | 283 |
| 286 class EasyUnlockAppManagerTest : public testing::Test { | 284 class EasyUnlockAppManagerTest : public testing::Test { |
| 287 public: | 285 public: |
| 288 EasyUnlockAppManagerTest() | 286 EasyUnlockAppManagerTest() |
| 289 : event_consumer_(&profile_), | 287 : event_consumer_(&profile_), |
| 290 command_line_(base::CommandLine::NO_PROGRAM) {} | 288 command_line_(base::CommandLine::NO_PROGRAM) {} |
| 291 ~EasyUnlockAppManagerTest() override {} | 289 ~EasyUnlockAppManagerTest() override {} |
| 292 | 290 |
| 293 void SetUp() override { | 291 void SetUp() override { |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 extension_misc::kEasyUnlockAppId); | 635 extension_misc::kEasyUnlockAppId); |
| 638 app_manager_->DisableAppIfLoaded(); | 636 app_manager_->DisableAppIfLoaded(); |
| 639 | 637 |
| 640 ASSERT_EQ(0u, event_consumer_.auth_attempted_count()); | 638 ASSERT_EQ(0u, event_consumer_.auth_attempted_count()); |
| 641 | 639 |
| 642 EXPECT_FALSE(app_manager_->SendAuthAttemptEvent()); | 640 EXPECT_FALSE(app_manager_->SendAuthAttemptEvent()); |
| 643 EXPECT_EQ(0u, event_consumer_.auth_attempted_count()); | 641 EXPECT_EQ(0u, event_consumer_.auth_attempted_count()); |
| 644 } | 642 } |
| 645 | 643 |
| 646 } // namespace | 644 } // namespace |
| OLD | NEW |