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

Unified Diff: chrome/browser/apps/ephemeral_app_launcher_browsertest.cc

Issue 389613006: Prevent duplicate concurrent installs of the same extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed update of webstore_result Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/extensions/active_install_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/ephemeral_app_launcher_browsertest.cc
diff --git a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc
index dcb1a7396795ee54aa68d8002e58c7d131ab9ede..5f60409599266210a40787a3fa2a119320391aa3 100644
--- a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc
+++ b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/extension_install_checker.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
+#include "chrome/browser/extensions/install_tracker.h"
#include "chrome/browser/extensions/test_blacklist.h"
#include "chrome/browser/extensions/webstore_installer_test.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -24,6 +25,7 @@ using extensions::Extension;
using extensions::ExtensionPrefs;
using extensions::ExtensionRegistry;
using extensions::ExtensionSystem;
+using extensions::InstallTracker;
namespace webstore_install = extensions::webstore_install;
namespace {
@@ -242,10 +244,17 @@ class EphemeralAppLauncherTest : public WebstoreInstallerTest {
void RunLaunchTest(const std::string& id,
webstore_install::Result expected_result,
bool expect_install_initiated) {
+ InstallTracker* tracker = InstallTracker::Get(profile());
+ ASSERT_TRUE(tracker);
+ bool was_install_active = !!tracker->GetActiveInstall(id);
+
scoped_refptr<EphemeralAppLauncherForTest> launcher(
new EphemeralAppLauncherForTest(id, profile()));
StartLauncherAndCheckResult(
launcher.get(), expected_result, expect_install_initiated);
+
+ // Verify that the install was deregistered from the InstallTracker.
+ EXPECT_EQ(was_install_active, !!tracker->GetActiveInstall(id));
}
void ValidateAppInstalledEphemerally(const std::string& id) {
@@ -519,3 +528,20 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest,
RunLaunchTest(app->id(), webstore_install::REQUIREMENT_VIOLATIONS, false);
}
+
+// Verifies that a launch will fail if the app is currently being installed.
+IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, InstallInProgress) {
+ extensions::ActiveInstallData install_data(kDefaultAppId);
+ InstallTracker::Get(profile())->AddActiveInstall(install_data);
+
+ RunLaunchTest(kDefaultAppId, webstore_install::INSTALL_IN_PROGRESS, false);
+}
+
+// Verifies that a launch will fail if a duplicate launch is in progress.
+IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, DuplicateLaunchInProgress) {
+ extensions::ActiveInstallData install_data(kDefaultAppId);
+ install_data.is_ephemeral = true;
+ InstallTracker::Get(profile())->AddActiveInstall(install_data);
+
+ RunLaunchTest(kDefaultAppId, webstore_install::LAUNCH_IN_PROGRESS, false);
+}
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/extensions/active_install_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698