| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "chrome/common/notification_details.h" | 12 #include "chrome/common/notification_details.h" |
| 13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 15 #include "chrome/common/notification_type.h" | 15 #include "chrome/common/notification_type.h" |
| 16 #include "chrome/test/in_process_browser_test.h" | 16 #include "chrome/test/in_process_browser_test.h" |
| 17 | 17 |
| 18 // Base class for extension browser tests. Provides utilities for loading, | 18 // Base class for extension browser tests. Provides utilities for loading, |
| 19 // unloading, and installing extensions. | 19 // unloading, and installing extensions. |
| 20 class ExtensionBrowserTest | 20 class ExtensionBrowserTest |
| 21 : public InProcessBrowserTest, public NotificationObserver { | 21 : public InProcessBrowserTest, public NotificationObserver { |
| 22 protected: | 22 protected: |
| 23 virtual void SetUpCommandLine(CommandLine* command_line); | 23 virtual void SetUpCommandLine(CommandLine* command_line); |
| 24 bool LoadExtension(const FilePath& path); | 24 bool LoadExtension(const FilePath& path); |
| 25 bool InstallExtension(const FilePath& path); | 25 // |expected_change| indicates how many extensions should be installed (or |
| 26 // disabled, if negative). |
| 27 // 1 means you expect a new install, 0 means you expect an upgrade, -1 means |
| 28 // you expect a failed upgrade. |
| 29 bool InstallExtension(const FilePath& path, int expected_change); |
| 26 void UninstallExtension(const std::string& extension_id); | 30 void UninstallExtension(const std::string& extension_id); |
| 27 | 31 |
| 28 // Wait for the number of visible page actions to change to |count|. | 32 // Wait for the number of visible page actions to change to |count|. |
| 29 bool WaitForPageActionVisibilityChangeTo(int count); | 33 bool WaitForPageActionVisibilityChangeTo(int count); |
| 30 | 34 |
| 31 bool loaded_; | 35 bool loaded_; |
| 32 bool installed_; | 36 bool installed_; |
| 33 FilePath test_data_dir_; | 37 FilePath test_data_dir_; |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 virtual void Observe(NotificationType type, | 40 virtual void Observe(NotificationType type, |
| 37 const NotificationSource& source, | 41 const NotificationSource& source, |
| 38 const NotificationDetails& details); | 42 const NotificationDetails& details); |
| 39 bool WaitForExtensionHostsToLoad(); | 43 bool WaitForExtensionHostsToLoad(); |
| 40 | |
| 41 NotificationRegistrar registrar_; | |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ | 46 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_H_ |
| OLD | NEW |