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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/extension_service_test_base.h" | 9 #include "chrome/browser/extensions/extension_service_test_base.h" |
10 #include "chrome/browser/extensions/test_extension_service.h" | 10 #include "chrome/browser/extensions/test_extension_service.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 .Set("manifest_version", 2) | 44 .Set("manifest_version", 2) |
45 .Build(); | 45 .Build(); |
46 scoped_refptr<extensions::Extension> extension = | 46 scoped_refptr<extensions::Extension> extension = |
47 extensions::ExtensionBuilder().SetManifest(manifest.Pass()) | 47 extensions::ExtensionBuilder().SetManifest(manifest.Pass()) |
48 .AddFlags(extensions::Extension::FROM_WEBSTORE | 48 .AddFlags(extensions::Extension::FROM_WEBSTORE |
49 | extensions::Extension::WAS_INSTALLED_BY_DEFAULT) | 49 | extensions::Extension::WAS_INSTALLED_BY_DEFAULT) |
50 .SetID(extension_misc::kHotwordExtensionId) | 50 .SetID(extension_misc::kHotwordExtensionId) |
51 .SetLocation(extensions::Manifest::EXTERNAL_COMPONENT) | 51 .SetLocation(extensions::Manifest::EXTERNAL_COMPONENT) |
52 .Build(); | 52 .Build(); |
53 ASSERT_TRUE(extension.get()); | 53 ASSERT_TRUE(extension.get()); |
54 service_->OnExtensionInstalled(extension, syncer::StringOrdinal()); | 54 service_->OnExtensionInstalled(extension.get(), syncer::StringOrdinal()); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 int uninstall_count() { return uninstall_count_; } | 58 int uninstall_count() { return uninstall_count_; } |
59 | 59 |
60 void SetExtensionService(ExtensionService* service) { service_ = service; } | 60 void SetExtensionService(ExtensionService* service) { service_ = service; } |
61 | 61 |
62 ExtensionService* extension_service() { return service_; } | 62 ExtensionService* extension_service() { return service_; } |
63 | 63 |
64 private: | 64 private: |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 EXPECT_EQ("fr_fr", | 304 EXPECT_EQ("fr_fr", |
305 profile()->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage)); | 305 profile()->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage)); |
306 | 306 |
307 // If the locale is set back to the last valid one, then an uninstall-install | 307 // If the locale is set back to the last valid one, then an uninstall-install |
308 // shouldn't be needed. | 308 // shouldn't be needed. |
309 SetApplicationLocale(profile(), "fr_fr"); | 309 SetApplicationLocale(profile(), "fr_fr"); |
310 EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile())); | 310 EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile())); |
311 EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension()); | 311 EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension()); |
312 EXPECT_EQ(1, hotword_service->uninstall_count()); // no change | 312 EXPECT_EQ(1, hotword_service->uninstall_count()); // no change |
313 } | 313 } |
OLD | NEW |