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

Unified Diff: chrome/browser/extensions/extension_service_test_with_install.h

Issue 1411773002: Move Sync-specific tests from ExtensionServiceTest into new file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@su_ext_reenable
Patch Set: . Created 5 years, 2 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
Index: chrome/browser/extensions/extension_service_test_with_install.h
diff --git a/chrome/browser/extensions/extension_service_test_with_install.h b/chrome/browser/extensions/extension_service_test_with_install.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c81788253f19414f831b8d5184391be04a0442c
--- /dev/null
+++ b/chrome/browser/extensions/extension_service_test_with_install.h
@@ -0,0 +1,117 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_WITH_INSTALL_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_WITH_INSTALL_H_
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "chrome/browser/extensions/extension_service_test_base.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "extensions/common/extension.h"
+
+namespace extensions {
+
+// An enhancement of ExtensionServiceTestBase that provides helpers to install,
+// update, and uninstall extensions.
+class ExtensionServiceTestWithInstall : public ExtensionServiceTestBase,
Marc Treib 2015/10/19 09:57:26 All this could have just been moved into Extension
Devlin 2015/10/20 17:42:15 I agree.
+ public content::NotificationObserver {
+ public:
+ ExtensionServiceTestWithInstall();
+ ~ExtensionServiceTestWithInstall() override;
+
+ protected:
+ static std::vector<base::string16> GetErrors();
+
+ void PackCRX(const base::FilePath& dir_path,
+ const base::FilePath& pem_path,
+ const base::FilePath& crx_path);
+
+ enum InstallState {
+ INSTALL_FAILED,
+ INSTALL_UPDATED,
+ INSTALL_NEW,
+ INSTALL_WITHOUT_LOAD,
+ };
+
+ const Extension* PackAndInstallCRX(const base::FilePath& dir_path,
+ const base::FilePath& pem_path,
+ InstallState install_state,
+ int creation_flags);
+ const Extension* PackAndInstallCRX(const base::FilePath& dir_path,
+ const base::FilePath& pem_path,
+ InstallState install_state);
+ const Extension* PackAndInstallCRX(const base::FilePath& dir_path,
+ InstallState install_state);
+
+ const Extension* InstallCRX(const base::FilePath& path,
+ InstallState install_state,
+ int creation_flags,
+ const std::string& expected_old_name);
+ const Extension* InstallCRX(const base::FilePath& path,
+ InstallState install_state,
+ int creation_flags);
+ const Extension* InstallCRX(const base::FilePath& path,
+ InstallState install_state);
+ const Extension* InstallCRXFromWebStore(const base::FilePath& path,
+ InstallState install_state);
+ const Extension* InstallCRXWithLocation(const base::FilePath& crx_path,
+ Manifest::Location install_location,
+ InstallState install_state);
+
+ const Extension* VerifyCrxInstall(const base::FilePath& path,
+ InstallState install_state);
+ const Extension* VerifyCrxInstall(const base::FilePath& path,
+ InstallState install_state,
+ const std::string& expected_old_name);
+
+ enum UpdateState {
+ FAILED_SILENTLY,
+ FAILED,
+ UPDATED,
+ INSTALLED,
+ DISABLED,
+ ENABLED
+ };
+
+ void PackCRXAndUpdateExtension(const std::string& id,
+ const base::FilePath& dir_path,
+ const base::FilePath& pem_path,
+ UpdateState expected_state);
+
+ void UpdateExtension(const std::string& id,
+ const base::FilePath& in_path,
+ UpdateState expected_state);
+
+ void UninstallExtension(const std::string& id, bool use_helper);
+ void UninstallExtension(const std::string& id,
+ bool use_helper,
+ Extension::State expected_state);
+
+ void TerminateExtension(const std::string& id);
+
+ // TODO(treib,rdcronin): Make these private and add accessors as needed.
Devlin 2015/10/20 17:42:15 nit: s/rdcronin/devlin
Marc Treib 2015/10/21 12:51:54 Done.
+ extensions::ExtensionList loaded_;
+ const Extension* installed_;
+ bool was_update_;
+ std::string old_name_;
+ std::string unloaded_id_;
+ UnloadedExtensionInfo::Reason unloaded_reason_;
+
+ private:
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
+
+ void InstallCRXInternal(const base::FilePath& crx_path, int creation_flags);
+
+ content::NotificationRegistrar registrar_;
+ size_t expected_extensions_count_;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_WITH_INSTALL_H_

Powered by Google App Engine
This is Rietveld 408576698