| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/webstore_startup_installer.h" | 10 #include "chrome/browser/extensions/webstore_startup_installer.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 extensions::webstore_install::Result result) { | 66 extensions::webstore_install::Result result) { |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 Profile* profile_; | 70 Profile* profile_; |
| 71 base::WeakPtrFactory<MockHotwordService> weak_factory_; | 71 base::WeakPtrFactory<MockHotwordService> weak_factory_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 std::unique_ptr<KeyedService> BuildMockHotwordService( | 74 std::unique_ptr<KeyedService> BuildMockHotwordService( |
| 75 content::BrowserContext* context) { | 75 content::BrowserContext* context) { |
| 76 return base::WrapUnique( | 76 return base::MakeUnique<MockHotwordService>(static_cast<Profile*>(context)); |
| 77 new MockHotwordService(static_cast<Profile*>(context))); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace | 79 } // namespace |
| 81 | 80 |
| 82 namespace extensions { | 81 namespace extensions { |
| 83 | 82 |
| 84 class HotwordInstallerBrowserTest : public ExtensionBrowserTest { | 83 class HotwordInstallerBrowserTest : public ExtensionBrowserTest { |
| 85 public: | 84 public: |
| 86 HotwordInstallerBrowserTest() {} | 85 HotwordInstallerBrowserTest() {} |
| 87 ~HotwordInstallerBrowserTest() override {} | 86 ~HotwordInstallerBrowserTest() override {} |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(HotwordInstallerBrowserTest); | 89 DISALLOW_COPY_AND_ASSIGN(HotwordInstallerBrowserTest); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 // Test that installing to a non-existent URL (which should hang) does not | 92 // Test that installing to a non-existent URL (which should hang) does not |
| 94 // crash. This test is successful if it does not crash and trigger any DCHECKS. | 93 // crash. This test is successful if it does not crash and trigger any DCHECKS. |
| 95 IN_PROC_BROWSER_TEST_F(HotwordInstallerBrowserTest, AbortInstallOnShutdown) { | 94 IN_PROC_BROWSER_TEST_F(HotwordInstallerBrowserTest, AbortInstallOnShutdown) { |
| 96 TestingProfile test_profile; | 95 TestingProfile test_profile; |
| 97 HotwordServiceFactory* hotword_service_factory = | 96 HotwordServiceFactory* hotword_service_factory = |
| 98 HotwordServiceFactory::GetInstance(); | 97 HotwordServiceFactory::GetInstance(); |
| 99 MockHotwordService* hotword_service = static_cast<MockHotwordService*>( | 98 MockHotwordService* hotword_service = static_cast<MockHotwordService*>( |
| 100 hotword_service_factory->SetTestingFactoryAndUse( | 99 hotword_service_factory->SetTestingFactoryAndUse( |
| 101 &test_profile, BuildMockHotwordService)); | 100 &test_profile, BuildMockHotwordService)); |
| 102 hotword_service->InstallHotwordExtensionFromWebstore(1); | 101 hotword_service->InstallHotwordExtensionFromWebstore(1); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace extensions | 104 } // namespace extensions |
| OLD | NEW |