| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // ProcessManager overrides: | 62 // ProcessManager overrides: |
| 63 bool CreateBackgroundHost(const extensions::Extension* extension, | 63 bool CreateBackgroundHost(const extensions::Extension* extension, |
| 64 const GURL& url) override { | 64 const GURL& url) override { |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); | 69 DISALLOW_COPY_AND_ASSIGN(TestProcessManager); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 KeyedService* CreateTestProcessManager(content::BrowserContext* context) { | 72 scoped_ptr<KeyedService> CreateTestProcessManager( |
| 73 return new TestProcessManager(context); | 73 content::BrowserContext* context) { |
| 74 return make_scoped_ptr(new TestProcessManager(context)); |
| 74 } | 75 } |
| 75 | 76 |
| 76 // Observes extension registry for unload and load events (in that order) of an | 77 // Observes extension registry for unload and load events (in that order) of an |
| 77 // extension with the provided extension id. | 78 // extension with the provided extension id. |
| 78 // Used to determine if an extension was reloaded. | 79 // Used to determine if an extension was reloaded. |
| 79 class ExtensionReloadTracker : public extensions::ExtensionRegistryObserver { | 80 class ExtensionReloadTracker : public extensions::ExtensionRegistryObserver { |
| 80 public: | 81 public: |
| 81 ExtensionReloadTracker(Profile* profile, const std::string& extension_id) | 82 ExtensionReloadTracker(Profile* profile, const std::string& extension_id) |
| 82 : profile_(profile), | 83 : profile_(profile), |
| 83 extension_id_(extension_id), | 84 extension_id_(extension_id), |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 event_consumer_ = event_consumer; | 256 event_consumer_ = event_consumer; |
| 256 } | 257 } |
| 257 | 258 |
| 258 private: | 259 private: |
| 259 EasyUnlockAppEventConsumer* event_consumer_; | 260 EasyUnlockAppEventConsumer* event_consumer_; |
| 260 | 261 |
| 261 DISALLOW_COPY_AND_ASSIGN(TestEventRouter); | 262 DISALLOW_COPY_AND_ASSIGN(TestEventRouter); |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 // TestEventRouter factory function | 265 // TestEventRouter factory function |
| 265 KeyedService* TestEventRouterFactoryFunction(content::BrowserContext* context) { | 266 scoped_ptr<KeyedService> TestEventRouterFactoryFunction( |
| 266 return new TestEventRouter(static_cast<Profile*>(context), | 267 content::BrowserContext* context) { |
| 267 extensions::ExtensionPrefs::Get(context)); | 268 return make_scoped_ptr( |
| 269 new TestEventRouter(static_cast<Profile*>(context), |
| 270 extensions::ExtensionPrefs::Get(context))); |
| 268 } | 271 } |
| 269 | 272 |
| 270 class EasyUnlockAppManagerTest : public testing::Test { | 273 class EasyUnlockAppManagerTest : public testing::Test { |
| 271 public: | 274 public: |
| 272 EasyUnlockAppManagerTest() | 275 EasyUnlockAppManagerTest() |
| 273 : event_consumer_(&profile_), | 276 : event_consumer_(&profile_), |
| 274 command_line_(base::CommandLine::NO_PROGRAM) {} | 277 command_line_(base::CommandLine::NO_PROGRAM) {} |
| 275 ~EasyUnlockAppManagerTest() override {} | 278 ~EasyUnlockAppManagerTest() override {} |
| 276 | 279 |
| 277 void SetUp() override { | 280 void SetUp() override { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 extension_misc::kEasyUnlockAppId); | 623 extension_misc::kEasyUnlockAppId); |
| 621 app_manager_->DisableAppIfLoaded(); | 624 app_manager_->DisableAppIfLoaded(); |
| 622 | 625 |
| 623 ASSERT_EQ(0u, event_consumer_.auth_attempted_count()); | 626 ASSERT_EQ(0u, event_consumer_.auth_attempted_count()); |
| 624 | 627 |
| 625 EXPECT_FALSE(app_manager_->SendAuthAttemptEvent()); | 628 EXPECT_FALSE(app_manager_->SendAuthAttemptEvent()); |
| 626 EXPECT_EQ(0u, event_consumer_.auth_attempted_count()); | 629 EXPECT_EQ(0u, event_consumer_.auth_attempted_count()); |
| 627 } | 630 } |
| 628 | 631 |
| 629 } // namespace | 632 } // namespace |
| OLD | NEW |