OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
19 #include "base/test/mock_entropy_provider.h" | 19 #include "base/test/mock_entropy_provider.h" |
20 #include "base/test/scoped_feature_list.h" | 20 #include "base/test/scoped_feature_list.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" | 22 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
22 #include "chrome/browser/extensions/component_loader.h" | 23 #include "chrome/browser/extensions/component_loader.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/extension_service_test_with_install.h" | 25 #include "chrome/browser/extensions/extension_service_test_with_install.h" |
25 #include "chrome/browser/extensions/extension_sync_data.h" | 26 #include "chrome/browser/extensions/extension_sync_data.h" |
26 #include "chrome/browser/extensions/extension_sync_service.h" | 27 #include "chrome/browser/extensions/extension_sync_service.h" |
27 #include "chrome/browser/extensions/extension_util.h" | 28 #include "chrome/browser/extensions/extension_util.h" |
28 #include "chrome/browser/extensions/scripting_permissions_modifier.h" | 29 #include "chrome/browser/extensions/scripting_permissions_modifier.h" |
29 #include "chrome/browser/extensions/updater/extension_updater.h" | 30 #include "chrome/browser/extensions/updater/extension_updater.h" |
30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 31 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 32 #include "chrome/browser/themes/theme_service.h" |
| 33 #include "chrome/browser/themes/theme_service_factory.h" |
31 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/extensions/sync_helper.h" | 36 #include "chrome/common/extensions/sync_helper.h" |
34 #include "chrome/common/features.h" | 37 #include "chrome/common/features.h" |
35 #include "chrome/test/base/testing_profile.h" | 38 #include "chrome/test/base/testing_profile.h" |
36 #include "components/browser_sync/profile_sync_service.h" | 39 #include "components/browser_sync/profile_sync_service.h" |
37 #include "components/crx_file/id_util.h" | 40 #include "components/crx_file/id_util.h" |
38 #include "components/sync/model/fake_sync_change_processor.h" | 41 #include "components/sync/model/fake_sync_change_processor.h" |
39 #include "components/sync/model/sync_change_processor_wrapper_for_test.h" | 42 #include "components/sync/model/sync_change_processor_wrapper_for_test.h" |
40 #include "components/sync/model/sync_data.h" | 43 #include "components/sync/model/sync_data.h" |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 | 1559 |
1557 // Sanity check: Installing an extension should result in a sync change. | 1560 // Sanity check: Installing an extension should result in a sync change. |
1558 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); | 1561 InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); |
1559 EXPECT_EQ(1u, processor->changes().size()); | 1562 EXPECT_EQ(1u, processor->changes().size()); |
1560 | 1563 |
1561 processor->changes().clear(); | 1564 processor->changes().clear(); |
1562 | 1565 |
1563 // Installing a theme should not result in a sync change (themes are handled | 1566 // Installing a theme should not result in a sync change (themes are handled |
1564 // separately by ThemeSyncableService). | 1567 // separately by ThemeSyncableService). |
1565 InstallCRX(data_dir().AppendASCII("theme.crx"), INSTALL_NEW); | 1568 InstallCRX(data_dir().AppendASCII("theme.crx"), INSTALL_NEW); |
| 1569 content::WindowedNotificationObserver theme_change_observer( |
| 1570 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 1571 content::Source<ThemeService>( |
| 1572 ThemeServiceFactory::GetForProfile(profile()))); |
| 1573 theme_change_observer.Wait(); |
1566 EXPECT_TRUE(processor->changes().empty()); | 1574 EXPECT_TRUE(processor->changes().empty()); |
1567 } | 1575 } |
1568 | 1576 |
1569 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 1577 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
1570 | 1578 |
1571 class ExtensionServiceTestSupervised | 1579 class ExtensionServiceTestSupervised |
1572 : public ExtensionServiceSyncCustomGalleryTest, | 1580 : public ExtensionServiceSyncCustomGalleryTest, |
1573 public SupervisedUserService::Delegate { | 1581 public SupervisedUserService::Delegate { |
1574 public: | 1582 public: |
1575 ExtensionServiceTestSupervised() | 1583 ExtensionServiceTestSupervised() |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 break; | 2474 break; |
2467 } | 2475 } |
2468 } | 2476 } |
2469 } | 2477 } |
2470 EXPECT_TRUE(found_delete); | 2478 EXPECT_TRUE(found_delete); |
2471 | 2479 |
2472 // Make sure there is one extension, and there are no more apps. | 2480 // Make sure there is one extension, and there are no more apps. |
2473 EXPECT_EQ(1u, extensions_processor.data().size()); | 2481 EXPECT_EQ(1u, extensions_processor.data().size()); |
2474 EXPECT_TRUE(apps_processor.data().empty()); | 2482 EXPECT_TRUE(apps_processor.data().empty()); |
2475 } | 2483 } |
OLD | NEW |