| 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 "chrome/browser/search/hotword_service.h" | 5 #include "chrome/browser/search/hotword_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ExtensionService* extension_service() { return service_; } | 111 ExtensionService* extension_service() { return service_; } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 ExtensionService* service_; | 114 ExtensionService* service_; |
| 115 int uninstall_count_; | 115 int uninstall_count_; |
| 116 std::string extension_id_; | 116 std::string extension_id_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 std::unique_ptr<KeyedService> BuildMockHotwordService( | 119 std::unique_ptr<KeyedService> BuildMockHotwordService( |
| 120 content::BrowserContext* context) { | 120 content::BrowserContext* context) { |
| 121 return base::WrapUnique( | 121 return base::MakeUnique<MockHotwordService>(static_cast<Profile*>(context)); |
| 122 new MockHotwordService(static_cast<Profile*>(context))); | |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace | 124 } // namespace |
| 126 | 125 |
| 127 class HotwordServiceTest : | 126 class HotwordServiceTest : |
| 128 public extensions::ExtensionServiceTestBase, | 127 public extensions::ExtensionServiceTestBase, |
| 129 public ::testing::WithParamInterface<const char*> { | 128 public ::testing::WithParamInterface<const char*> { |
| 130 protected: | 129 protected: |
| 131 HotwordServiceTest() {} | 130 HotwordServiceTest() {} |
| 132 virtual ~HotwordServiceTest() {} | 131 virtual ~HotwordServiceTest() {} |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 EXPECT_EQ(1, audio_history_handler->GetAudioHistoryCalls()); | 525 EXPECT_EQ(1, audio_history_handler->GetAudioHistoryCalls()); |
| 527 // We expect the next check for audio history to be in the queue. | 526 // We expect the next check for audio history to be in the queue. |
| 528 EXPECT_EQ(base::TimeDelta::FromDays(1), | 527 EXPECT_EQ(base::TimeDelta::FromDays(1), |
| 529 test_task_runner->NextPendingTaskDelay()); | 528 test_task_runner->NextPendingTaskDelay()); |
| 530 EXPECT_TRUE(test_task_runner->HasPendingTask()); | 529 EXPECT_TRUE(test_task_runner->HasPendingTask()); |
| 531 test_task_runner->RunPendingTasks(); | 530 test_task_runner->RunPendingTasks(); |
| 532 EXPECT_EQ(2, audio_history_handler->GetAudioHistoryCalls()); | 531 EXPECT_EQ(2, audio_history_handler->GetAudioHistoryCalls()); |
| 533 EXPECT_TRUE(test_task_runner->HasPendingTask()); | 532 EXPECT_TRUE(test_task_runner->HasPendingTask()); |
| 534 test_task_runner->ClearPendingTasks(); | 533 test_task_runner->ClearPendingTasks(); |
| 535 } | 534 } |
| OLD | NEW |