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

Side by Side Diff: chrome/browser/apps/ephemeral_app_browsertest.cc

Issue 345493002: Promotion of ephemeral apps now handles permission escalation correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/apps/ephemeral_app_browsertest.h" 5 #include "chrome/browser/apps/ephemeral_app_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 VerifySyncChange(sync_change.get(), true); 547 VerifySyncChange(sync_change.get(), true);
548 } 548 }
549 549
550 // Verifies that promoting an ephemeral app will enable it. 550 // Verifies that promoting an ephemeral app will enable it.
551 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteEphemeralAppAndEnable) { 551 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, PromoteEphemeralAppAndEnable) {
552 InitSyncService(); 552 InitSyncService();
553 553
554 const Extension* app = InstallEphemeralApp(kNotificationsTestApp); 554 const Extension* app = InstallEphemeralApp(kNotificationsTestApp);
555 ASSERT_TRUE(app); 555 ASSERT_TRUE(app);
556 556
557 // Disable the ephemeral app. 557 // Disable the ephemeral app due to a permissions increase. This also involves
558 // setting the DidExtensionEscalatePermissions flag.
559 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
560 prefs->SetDidExtensionEscalatePermissions(app, true);
558 ExtensionService* service = 561 ExtensionService* service =
559 ExtensionSystem::Get(profile())->extension_service(); 562 ExtensionSystem::Get(profile())->extension_service();
560 service->DisableExtension(app->id(), Extension::DISABLE_PERMISSIONS_INCREASE); 563 service->DisableExtension(app->id(), Extension::DISABLE_PERMISSIONS_INCREASE);
561 ASSERT_TRUE(ExtensionRegistry::Get(profile())-> 564 ASSERT_TRUE(ExtensionRegistry::Get(profile())->
562 GetExtensionById(app->id(), ExtensionRegistry::DISABLED)); 565 GetExtensionById(app->id(), ExtensionRegistry::DISABLED));
563 566
564 // Promote to a regular installed app. It should be enabled. 567 // Promote to a regular installed app. It should be enabled.
565 PromoteEphemeralApp(app); 568 PromoteEphemeralApp(app);
566 VerifyPromotedApp(app->id(), ExtensionRegistry::ENABLED); 569 VerifyPromotedApp(app->id(), ExtensionRegistry::ENABLED);
570 EXPECT_FALSE(prefs->DidExtensionEscalatePermissions(app->id()));
567 571
568 scoped_ptr<AppSyncData> sync_change = GetFirstSyncChangeForApp(app->id()); 572 scoped_ptr<AppSyncData> sync_change = GetFirstSyncChangeForApp(app->id());
569 VerifySyncChange(sync_change.get(), true); 573 VerifySyncChange(sync_change.get(), true);
570 } 574 }
571 575
572 // Verifies that promoting an ephemeral app that has unsupported requirements 576 // Verifies that promoting an ephemeral app that has unsupported requirements
573 // will not enable it. 577 // will not enable it.
574 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, 578 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest,
575 PromoteUnsupportedEphemeralApp) { 579 PromoteUnsupportedEphemeralApp) {
576 InitSyncService(); 580 InitSyncService();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 CloseApp(app_id); 674 CloseApp(app_id);
671 installed_signal.Wait(); 675 installed_signal.Wait();
672 VerifyPromotedApp(app_id, ExtensionRegistry::ENABLED); 676 VerifyPromotedApp(app_id, ExtensionRegistry::ENABLED);
673 677
674 // Check the notification parameters. 678 // Check the notification parameters.
675 const InstallObserver::InstallParameters& params = installed_observer.Last(); 679 const InstallObserver::InstallParameters& params = installed_observer.Last();
676 EXPECT_EQ(app_id, params.id); 680 EXPECT_EQ(app_id, params.id);
677 EXPECT_TRUE(params.is_update); 681 EXPECT_TRUE(params.is_update);
678 EXPECT_TRUE(params.from_ephemeral); 682 EXPECT_TRUE(params.from_ephemeral);
679 } 683 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698