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/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" | 6 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 virtual ~MockHotwordService() {} | 21 virtual ~MockHotwordService() {} |
22 | 22 |
23 virtual bool IsServiceAvailable() OVERRIDE { | 23 virtual bool IsServiceAvailable() OVERRIDE { |
24 return service_available_; | 24 return service_available_; |
25 } | 25 } |
26 | 26 |
27 void setServiceAvailable(bool available) { | 27 void setServiceAvailable(bool available) { |
28 service_available_ = available; | 28 service_available_ = available; |
29 } | 29 } |
30 | 30 |
31 static BrowserContextKeyedService* Build(content::BrowserContext* profile) { | 31 static KeyedService* Build(content::BrowserContext* profile) { |
32 return new MockHotwordService(static_cast<Profile*>(profile)); | 32 return new MockHotwordService(static_cast<Profile*>(profile)); |
33 } | 33 } |
34 | 34 |
35 private: | 35 private: |
36 bool service_available_; | 36 bool service_available_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(MockHotwordService); | 38 DISALLOW_COPY_AND_ASSIGN(MockHotwordService); |
39 }; | 39 }; |
40 | 40 |
41 class HotwordPrivateApiTest : public ExtensionApiTest { | 41 class HotwordPrivateApiTest : public ExtensionApiTest { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 extensions::HotwordPrivateEventService::GetFactoryInstance(); | 102 extensions::HotwordPrivateEventService::GetFactoryInstance(); |
103 ExtensionTestMessageListener listener("ready", false); | 103 ExtensionTestMessageListener listener("ready", false); |
104 LoadExtensionAsComponent( | 104 LoadExtensionAsComponent( |
105 test_data_dir_.AppendASCII("onEnabledChanged")); | 105 test_data_dir_.AppendASCII("onEnabledChanged")); |
106 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 106 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
107 | 107 |
108 ExtensionTestMessageListener listenerNotification("notification", false); | 108 ExtensionTestMessageListener listenerNotification("notification", false); |
109 profile()->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, true); | 109 profile()->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, true); |
110 EXPECT_TRUE(listenerNotification.WaitUntilSatisfied()); | 110 EXPECT_TRUE(listenerNotification.WaitUntilSatisfied()); |
111 } | 111 } |
OLD | NEW |