OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
11 #include "chrome/browser/extensions/api/storage/settings_namespace.h" | 11 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
12 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 12 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" |
13 #include "chrome/browser/extensions/extension_apitest.h" | 13 #include "chrome/browser/extensions/extension_apitest.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/extension_system.h" | |
16 #include "chrome/browser/extensions/extension_system_factory.h" | 15 #include "chrome/browser/extensions/extension_system_factory.h" |
17 #include "chrome/browser/extensions/extension_test_message_listener.h" | 16 #include "chrome/browser/extensions/extension_test_message_listener.h" |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "extensions/browser/extension_system.h" |
21 #include "extensions/common/value_builder.h" | 21 #include "extensions/common/value_builder.h" |
22 #include "sync/api/sync_change.h" | 22 #include "sync/api/sync_change.h" |
23 #include "sync/api/sync_change_processor.h" | 23 #include "sync/api/sync_change_processor.h" |
24 #include "sync/api/sync_error_factory.h" | 24 #include "sync/api/sync_error_factory.h" |
25 #include "sync/api/sync_error_factory_mock.h" | 25 #include "sync/api/sync_error_factory_mock.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
27 | 27 |
28 #if defined(ENABLE_CONFIGURATION_POLICY) | 28 #if defined(ENABLE_CONFIGURATION_POLICY) |
29 #include "chrome/browser/policy/schema_registry_service.h" | 29 #include "chrome/browser/policy/schema_registry_service.h" |
30 #include "chrome/browser/policy/schema_registry_service_factory.h" | 30 #include "chrome/browser/policy/schema_registry_service_factory.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 #else | 451 #else |
452 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 452 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
453 #endif | 453 #endif |
454 } | 454 } |
455 | 455 |
456 #if defined(ENABLE_CONFIGURATION_POLICY) | 456 #if defined(ENABLE_CONFIGURATION_POLICY) |
457 | 457 |
458 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ExtensionsSchemas) { | 458 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ExtensionsSchemas) { |
459 // Verifies that the Schemas for the extensions domain are created on startup. | 459 // Verifies that the Schemas for the extensions domain are created on startup. |
460 Profile* profile = browser()->profile(); | 460 Profile* profile = browser()->profile(); |
461 ExtensionSystem* extension_system = | 461 ExtensionSystem* extension_system = ExtensionSystem::Get(profile); |
462 ExtensionSystemFactory::GetForProfile(profile); | |
463 if (!extension_system->ready().is_signaled()) { | 462 if (!extension_system->ready().is_signaled()) { |
464 // Wait until the extension system is ready. | 463 // Wait until the extension system is ready. |
465 base::RunLoop run_loop; | 464 base::RunLoop run_loop; |
466 extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure()); | 465 extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure()); |
467 run_loop.Run(); | 466 run_loop.Run(); |
468 ASSERT_TRUE(extension_system->ready().is_signaled()); | 467 ASSERT_TRUE(extension_system->ready().is_signaled()); |
469 } | 468 } |
470 | 469 |
471 // This test starts without any test extensions installed. | 470 // This test starts without any test extensions installed. |
472 EXPECT_FALSE(GetSingleLoadedExtension()); | 471 EXPECT_FALSE(GetSingleLoadedExtension()); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 SettingsFrontend* frontend = | 613 SettingsFrontend* frontend = |
615 browser()->profile()->GetExtensionService()->settings_frontend(); | 614 browser()->profile()->GetExtensionService()->settings_frontend(); |
616 frontend->DisableStorageForTesting(MANAGED); | 615 frontend->DisableStorageForTesting(MANAGED); |
617 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 616 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
618 // Now run the extension. | 617 // Now run the extension. |
619 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 618 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
620 << message_; | 619 << message_; |
621 } | 620 } |
622 | 621 |
623 } // namespace extensions | 622 } // namespace extensions |
OLD | NEW |