Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: chrome/browser/extensions/extension_service_sync_unittest.cc

Issue 2468723003: Move session service and supervised users to buildflags. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/extensions/extension_service_test_with_install.h" 24 #include "chrome/browser/extensions/extension_service_test_with_install.h"
25 #include "chrome/browser/extensions/extension_sync_data.h" 25 #include "chrome/browser/extensions/extension_sync_data.h"
26 #include "chrome/browser/extensions/extension_sync_service.h" 26 #include "chrome/browser/extensions/extension_sync_service.h"
27 #include "chrome/browser/extensions/extension_util.h" 27 #include "chrome/browser/extensions/extension_util.h"
28 #include "chrome/browser/extensions/scripting_permissions_modifier.h" 28 #include "chrome/browser/extensions/scripting_permissions_modifier.h"
29 #include "chrome/browser/extensions/updater/extension_updater.h" 29 #include "chrome/browser/extensions/updater/extension_updater.h"
30 #include "chrome/browser/sync/profile_sync_service_factory.h" 30 #include "chrome/browser/sync/profile_sync_service_factory.h"
31 #include "chrome/common/chrome_constants.h" 31 #include "chrome/common/chrome_constants.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/extensions/sync_helper.h" 33 #include "chrome/common/extensions/sync_helper.h"
34 #include "chrome/common/features.h"
34 #include "chrome/test/base/testing_profile.h" 35 #include "chrome/test/base/testing_profile.h"
35 #include "components/browser_sync/profile_sync_service.h" 36 #include "components/browser_sync/profile_sync_service.h"
36 #include "components/crx_file/id_util.h" 37 #include "components/crx_file/id_util.h"
37 #include "components/sync/model/fake_sync_change_processor.h" 38 #include "components/sync/model/fake_sync_change_processor.h"
38 #include "components/sync/model/sync_change_processor_wrapper_for_test.h" 39 #include "components/sync/model/sync_change_processor_wrapper_for_test.h"
39 #include "components/sync/model/sync_data.h" 40 #include "components/sync/model/sync_data.h"
40 #include "components/sync/model/sync_error_factory_mock.h" 41 #include "components/sync/model/sync_error_factory_mock.h"
41 #include "components/variations/variations_associated_data.h" 42 #include "components/variations/variations_associated_data.h"
42 #include "extensions/browser/api_test_utils.h" 43 #include "extensions/browser/api_test_utils.h"
43 #include "extensions/browser/app_sorting.h" 44 #include "extensions/browser/app_sorting.h"
44 #include "extensions/browser/extension_prefs.h" 45 #include "extensions/browser/extension_prefs.h"
45 #include "extensions/browser/extension_registry.h" 46 #include "extensions/browser/extension_registry.h"
46 #include "extensions/browser/extension_system.h" 47 #include "extensions/browser/extension_system.h"
47 #include "extensions/browser/management_policy.h" 48 #include "extensions/browser/management_policy.h"
48 #include "extensions/browser/test_management_policy.h" 49 #include "extensions/browser/test_management_policy.h"
49 #include "extensions/common/constants.h" 50 #include "extensions/common/constants.h"
50 #include "extensions/common/extension_builder.h" 51 #include "extensions/common/extension_builder.h"
51 #include "extensions/common/manifest_url_handlers.h" 52 #include "extensions/common/manifest_url_handlers.h"
52 #include "extensions/common/permissions/permission_set.h" 53 #include "extensions/common/permissions/permission_set.h"
53 #include "extensions/common/value_builder.h" 54 #include "extensions/common/value_builder.h"
54 #include "testing/gtest/include/gtest/gtest.h" 55 #include "testing/gtest/include/gtest/gtest.h"
55 56
56 #if defined(ENABLE_SUPERVISED_USERS) 57 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
57 #include "chrome/browser/supervised_user/permission_request_creator.h" 58 #include "chrome/browser/supervised_user/permission_request_creator.h"
58 #include "chrome/browser/supervised_user/supervised_user_constants.h" 59 #include "chrome/browser/supervised_user/supervised_user_constants.h"
59 #include "chrome/browser/supervised_user/supervised_user_features.h" 60 #include "chrome/browser/supervised_user/supervised_user_features.h"
60 #include "chrome/browser/supervised_user/supervised_user_service.h" 61 #include "chrome/browser/supervised_user/supervised_user_service.h"
61 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 62 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
62 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 63 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
63 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h" 64 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h"
64 #include "chrome/common/pref_names.h" 65 #include "chrome/common/pref_names.h"
65 #endif 66 #endif
66 67
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 EXPECT_EQ(1u, processor->changes().size()); 1550 EXPECT_EQ(1u, processor->changes().size());
1550 1551
1551 processor->changes().clear(); 1552 processor->changes().clear();
1552 1553
1553 // Installing a theme should not result in a sync change (themes are handled 1554 // Installing a theme should not result in a sync change (themes are handled
1554 // separately by ThemeSyncableService). 1555 // separately by ThemeSyncableService).
1555 InstallCRX(data_dir().AppendASCII("theme.crx"), INSTALL_NEW); 1556 InstallCRX(data_dir().AppendASCII("theme.crx"), INSTALL_NEW);
1556 EXPECT_TRUE(processor->changes().empty()); 1557 EXPECT_TRUE(processor->changes().empty());
1557 } 1558 }
1558 1559
1559 #if defined(ENABLE_SUPERVISED_USERS) 1560 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
1560 1561
1561 class ExtensionServiceTestSupervised : public ExtensionServiceSyncTest, 1562 class ExtensionServiceTestSupervised : public ExtensionServiceSyncTest,
1562 public SupervisedUserService::Delegate { 1563 public SupervisedUserService::Delegate {
1563 public: 1564 public:
1564 ExtensionServiceTestSupervised() 1565 ExtensionServiceTestSupervised()
1565 : field_trial_list_(base::MakeUnique<base::MockEntropyProvider>()) {} 1566 : field_trial_list_(base::MakeUnique<base::MockEntropyProvider>()) {}
1566 1567
1567 void SetUp() override { 1568 void SetUp() override {
1568 ExtensionServiceSyncTest::SetUp(); 1569 ExtensionServiceSyncTest::SetUp();
1569 1570
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); 2374 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
2374 2375
2375 const Extension* enabled_extension = 2376 const Extension* enabled_extension =
2376 registry()->enabled_extensions().GetByID(id); 2377 registry()->enabled_extensions().GetByID(id);
2377 ASSERT_TRUE(enabled_extension); 2378 ASSERT_TRUE(enabled_extension);
2378 ScriptingPermissionsModifier modifier(profile(), enabled_extension); 2379 ScriptingPermissionsModifier modifier(profile(), enabled_extension);
2379 EXPECT_FALSE(modifier.IsAllowedOnAllUrls()); 2380 EXPECT_FALSE(modifier.IsAllowedOnAllUrls());
2380 EXPECT_TRUE(modifier.HasSetAllowedOnAllUrls()); 2381 EXPECT_TRUE(modifier.HasSetAllowedOnAllUrls());
2381 } 2382 }
2382 2383
2383 #endif // defined(ENABLE_SUPERVISED_USERS) 2384 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
2384 2385
2385 // Tests sync behavior in the case of an item that starts out as an app and 2386 // Tests sync behavior in the case of an item that starts out as an app and
2386 // gets updated to become an extension. 2387 // gets updated to become an extension.
2387 TEST_F(ExtensionServiceSyncTest, AppToExtension) { 2388 TEST_F(ExtensionServiceSyncTest, AppToExtension) {
2388 InitializeEmptyExtensionService(); 2389 InitializeEmptyExtensionService();
2389 service()->Init(); 2390 service()->Init();
2390 ASSERT_TRUE(service()->is_ready()); 2391 ASSERT_TRUE(service()->is_ready());
2391 2392
2392 // Install v1, which is an app. 2393 // Install v1, which is an app.
2393 const Extension* v1 = 2394 const Extension* v1 =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 break; 2468 break;
2468 } 2469 }
2469 } 2470 }
2470 } 2471 }
2471 EXPECT_TRUE(found_delete); 2472 EXPECT_TRUE(found_delete);
2472 2473
2473 // Make sure there is one extension, and there are no more apps. 2474 // Make sure there is one extension, and there are no more apps.
2474 EXPECT_EQ(1u, extensions_processor.data().size()); 2475 EXPECT_EQ(1u, extensions_processor.data().size());
2475 EXPECT_TRUE(apps_processor.data().empty()); 2476 EXPECT_TRUE(apps_processor.data().empty());
2476 } 2477 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698