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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" | 7 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | |
11 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search/hotword_client.h" | 11 #include "chrome/browser/search/hotword_client.h" |
13 #include "chrome/browser/search/hotword_service.h" | 12 #include "chrome/browser/search/hotword_service.h" |
14 #include "chrome/browser/search/hotword_service_factory.h" | 13 #include "chrome/browser/search/hotword_service_factory.h" |
15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
17 #include "extensions/common/switches.h" | 16 #include "extensions/common/switches.h" |
| 17 #include "extensions/test/extension_test_message_listener.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const char kHotwordTestExtensionId[] = "cpfhkdbjfdgdebcjlifoldbijinjfifp"; | 21 const char kHotwordTestExtensionId[] = "cpfhkdbjfdgdebcjlifoldbijinjfifp"; |
22 | 22 |
23 class MockHotwordService : public HotwordService { | 23 class MockHotwordService : public HotwordService { |
24 public: | 24 public: |
25 explicit MockHotwordService(Profile* profile) | 25 explicit MockHotwordService(Profile* profile) |
26 : HotwordService(profile), service_available_(true) {}; | 26 : HotwordService(profile), service_available_(true) {}; |
27 virtual ~MockHotwordService() {} | 27 virtual ~MockHotwordService() {} |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 MockHotwordClient client; | 234 MockHotwordClient client; |
235 service()->RequestHotwordSession(&client); | 235 service()->RequestHotwordSession(&client); |
236 EXPECT_TRUE(listenerStopReady.WaitUntilSatisfied()); | 236 EXPECT_TRUE(listenerStopReady.WaitUntilSatisfied()); |
237 service()->StopHotwordSession(&client); | 237 service()->StopHotwordSession(&client); |
238 EXPECT_TRUE(listenerStopped.WaitUntilSatisfied()); | 238 EXPECT_TRUE(listenerStopped.WaitUntilSatisfied()); |
239 | 239 |
240 EXPECT_TRUE(client.last_enabled()); | 240 EXPECT_TRUE(client.last_enabled()); |
241 EXPECT_EQ(1, client.state_changed_count()); | 241 EXPECT_EQ(1, client.state_changed_count()); |
242 EXPECT_EQ(1, client.recognized_count()); | 242 EXPECT_EQ(1, client.recognized_count()); |
243 } | 243 } |
OLD | NEW |