summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc43
-rw-r--r--chrome/browser/automation/automation_provider.h9
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc59
-rw-r--r--chrome/browser/automation/automation_provider_observers.h26
-rw-r--r--chrome/common/automation_constants.h5
-rw-r--r--chrome/common/automation_messages.cc39
-rw-r--r--chrome/common/automation_messages.h9
-rw-r--r--chrome/common/automation_messages_internal.h18
-rw-r--r--chrome/test/automation/automation_proxy.cc6
-rw-r--r--chrome/test/automation/automation_proxy.h4
-rw-r--r--chrome/test/functional/chromeos_security.py10
-rw-r--r--chrome/test/functional/extensions.py4
-rw-r--r--chrome/test/functional/memory.py5
-rw-r--r--chrome/test/functional/ntp.py15
-rw-r--r--chrome/test/functional/themes.py9
-rw-r--r--chrome/test/pyautolib/pyautolib.cc9
-rw-r--r--chrome/test/pyautolib/pyautolib.h4
-rw-r--r--chrome/test/pyautolib/pyautolib.i10
18 files changed, 61 insertions, 223 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 1dfa293..6f9472e 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -325,13 +325,10 @@ bool AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_ReloadAsync, ReloadAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_StopAsync, StopAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_SetPageFontSize, OnSetPageFontSize)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InstallExtension,
- InstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForExtensionTestResult,
WaitForExtensionTestResult)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(
- AutomationMsg_InstallExtensionAndGetHandle,
- InstallExtensionAndGetHandle)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InstallExtension,
+ InstallExtension)
IPC_MESSAGE_HANDLER(AutomationMsg_UninstallExtension,
UninstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_EnableExtension,
@@ -763,26 +760,6 @@ RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) {
return NULL;
}
-void AutomationProvider::InstallExtension(const FilePath& crx_path,
- IPC::Message* reply_message) {
- ExtensionService* service = profile_->GetExtensionService();
- if (service) {
- // The observer will delete itself when done.
- new ExtensionInstallNotificationObserver(this,
- AutomationMsg_InstallExtension::ID,
- reply_message);
-
- // Pass NULL for a silent install with no UI.
- scoped_refptr<CrxInstaller> installer(service->MakeCrxInstaller(NULL));
- installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION);
- installer->InstallCrx(crx_path);
- } else {
- AutomationMsg_InstallExtension::WriteReplyParams(
- reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED);
- Send(reply_message);
- }
-}
-
void AutomationProvider::WaitForExtensionTestResult(
IPC::Message* reply_message) {
DCHECK(!reply_message_);
@@ -792,8 +769,9 @@ void AutomationProvider::WaitForExtensionTestResult(
extension_test_result_observer_->MaybeSendResult();
}
-void AutomationProvider::InstallExtensionAndGetHandle(
- const FilePath& crx_path, bool with_ui, IPC::Message* reply_message) {
+void AutomationProvider::InstallExtension(
+ const FilePath& extension_path, bool with_ui,
+ IPC::Message* reply_message) {
ExtensionService* service = profile_->GetExtensionService();
ExtensionProcessManager* manager = profile_->GetExtensionProcessManager();
if (service && manager) {
@@ -801,23 +779,22 @@ void AutomationProvider::InstallExtensionAndGetHandle(
new ExtensionReadyNotificationObserver(
manager,
this,
- AutomationMsg_InstallExtensionAndGetHandle::ID,
+ AutomationMsg_InstallExtension::ID,
reply_message);
- if (crx_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) {
+ if (extension_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) {
ExtensionInstallUI* client =
(with_ui ? new ExtensionInstallUI(profile_) : NULL);
scoped_refptr<CrxInstaller> installer(service->MakeCrxInstaller(client));
if (!with_ui)
installer->set_allow_silent_install(true);
installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION);
- installer->InstallCrx(crx_path);
+ installer->InstallCrx(extension_path);
} else {
- service->LoadExtension(crx_path, with_ui);
+ service->LoadExtension(extension_path, with_ui);
}
} else {
- AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams(
- reply_message, 0);
+ AutomationMsg_InstallExtension::WriteReplyParams(reply_message, 0);
Send(reply_message);
}
}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index e907150..b389b88 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -250,14 +250,11 @@ class AutomationProvider
// for information on the arguments.
void JavaScriptStressTestControl(int handle, int cmd, int param);
- void InstallExtension(const FilePath& crx_path,
- IPC::Message* reply_message);
-
void WaitForExtensionTestResult(IPC::Message* reply_message);
- void InstallExtensionAndGetHandle(const FilePath& crx_path,
- bool with_ui,
- IPC::Message* reply_message);
+ void InstallExtension(const FilePath& extension_path,
+ bool with_ui,
+ IPC::Message* reply_message);
void UninstallExtension(int extension_handle,
bool* success);
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index bb5f44a..61dfc6a 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -464,61 +464,6 @@ bool DidExtensionHostsStopLoading(ExtensionProcessManager* manager) {
return true;
}
-ExtensionInstallNotificationObserver::ExtensionInstallNotificationObserver(
- AutomationProvider* automation, int id, IPC::Message* reply_message)
- : automation_(automation->AsWeakPtr()),
- id_(id),
- reply_message_(reply_message) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
- NotificationService::AllSources());
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
- NotificationService::AllSources());
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
- NotificationService::AllSources());
-}
-
-ExtensionInstallNotificationObserver::~ExtensionInstallNotificationObserver() {
-}
-
-void ExtensionInstallNotificationObserver::Observe(
- int type, const NotificationSource& source,
- const NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_EXTENSION_LOADED:
- SendResponse(AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED);
- break;
- case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR:
- case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED:
- SendResponse(AUTOMATION_MSG_EXTENSION_INSTALL_FAILED);
- break;
- default:
- NOTREACHED();
- break;
- }
-
- delete this;
-}
-
-void ExtensionInstallNotificationObserver::SendResponse(
- AutomationMsg_ExtensionResponseValues response) {
- if (!automation_ || !reply_message_.get()) {
- delete this;
- return;
- }
-
- switch (id_) {
- case AutomationMsg_InstallExtension::ID:
- AutomationMsg_InstallExtension::WriteReplyParams(reply_message_.get(),
- response);
- break;
- default:
- NOTREACHED();
- break;
- }
-
- automation_->Send(reply_message_.release());
-}
-
ExtensionUninstallObserver::ExtensionUninstallObserver(
AutomationProvider* automation,
IPC::Message* reply_message,
@@ -626,12 +571,12 @@ void ExtensionReadyNotificationObserver::Observe(
break;
}
- if (id_ == AutomationMsg_InstallExtensionAndGetHandle::ID) {
+ if (id_ == AutomationMsg_InstallExtension::ID) {
// A handle of zero indicates an error.
int extension_handle = 0;
if (extension_)
extension_handle = automation_->AddExtension(extension_);
- AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams(
+ AutomationMsg_InstallExtension::WriteReplyParams(
reply_message_.get(), extension_handle);
} else if (id_ == AutomationMsg_EnableExtension::ID) {
AutomationMsg_EnableExtension::WriteReplyParams(reply_message_.get(), true);
diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h
index 1a8ca9c..d4d54a6 100644
--- a/chrome/browser/automation/automation_provider_observers.h
+++ b/chrome/browser/automation/automation_provider_observers.h
@@ -283,32 +283,6 @@ class TabCountChangeObserver : public TabStripModelObserver {
DISALLOW_COPY_AND_ASSIGN(TabCountChangeObserver);
};
-// Observes when an extension has finished installing or possible install
-// errors. This does not guarantee that the extension is ready for use.
-class ExtensionInstallNotificationObserver : public NotificationObserver {
- public:
- ExtensionInstallNotificationObserver(AutomationProvider* automation,
- int id,
- IPC::Message* reply_message);
- virtual ~ExtensionInstallNotificationObserver();
-
- // Implementation of NotificationObserver.
- virtual void Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- // Send |response| back to the provider's client.
- void SendResponse(AutomationMsg_ExtensionResponseValues response);
-
- NotificationRegistrar registrar_;
- base::WeakPtr<AutomationProvider> automation_;
- int id_;
- scoped_ptr<IPC::Message> reply_message_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionInstallNotificationObserver);
-};
-
// Observes when an extension has been uninstalled.
class ExtensionUninstallObserver : public NotificationObserver {
public:
diff --git a/chrome/common/automation_constants.h b/chrome/common/automation_constants.h
index 1b524d1..05cab9f 100644
--- a/chrome/common/automation_constants.h
+++ b/chrome/common/automation_constants.h
@@ -80,11 +80,6 @@ enum AutomationMsg_NavigationResponseValues {
AUTOMATION_MSG_NAVIGATION_BLOCKED_BY_MODAL_DIALOG,
};
-enum AutomationMsg_ExtensionResponseValues {
- AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED = 0,
- AUTOMATION_MSG_EXTENSION_INSTALL_FAILED
-};
-
// Used in the AutomationMsg_GetExtensionProperty to identify which extension
// property should be retrieved, instead of having separate messages for each
// property.
diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc
index 39420cd..2c79dd3 100644
--- a/chrome/common/automation_messages.cc
+++ b/chrome/common/automation_messages.cc
@@ -259,45 +259,6 @@ void ParamTraits<AutomationMsg_NavigationResponseValues>::Log(
}
// static
-void ParamTraits<AutomationMsg_ExtensionResponseValues>::Write(
- Message* m,
- const param_type& p) {
- m->WriteInt(p);
-}
-
-// static
-bool ParamTraits<AutomationMsg_ExtensionResponseValues>::Read(
- const Message* m,
- void** iter,
- param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<AutomationMsg_ExtensionResponseValues>(type);
- return true;
-}
-
-// static
-void ParamTraits<AutomationMsg_ExtensionResponseValues>::Log(
- const param_type& p,
- std::string* l) {
- std::string control;
- switch (p) {
- case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED:
- control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED";
- break;
- case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED:
- control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED";
- break;
- default:
- control = "UNKNOWN";
- break;
- }
-
- LogParam(control, l);
-}
-
-// static
void ParamTraits<AutomationMsg_ExtensionProperty>::Write(Message* m,
const param_type& p) {
m->WriteInt(p);
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h
index 91ec439..d26da83 100644
--- a/chrome/common/automation_messages.h
+++ b/chrome/common/automation_messages.h
@@ -264,14 +264,6 @@ struct ParamTraits<AutomationMsg_NavigationResponseValues> {
};
template <>
-struct ParamTraits<AutomationMsg_ExtensionResponseValues> {
- typedef AutomationMsg_ExtensionResponseValues param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct ParamTraits<AutomationMsg_ExtensionProperty> {
typedef AutomationMsg_ExtensionProperty param_type;
static void Write(Message* m, const param_type& p);
@@ -416,4 +408,3 @@ struct ParamTraits<AttachExternalTabParams> {
// Keep this internal message file unchanged to preserve line numbering
// (and hence the dubious __LINE__-based message numberings) across versions.
#include "chrome/common/automation_messages_internal.h"
-
diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h
index 4502a24..e8c2520 100644
--- a/chrome/common/automation_messages_internal.h
+++ b/chrome/common/automation_messages_internal.h
@@ -1128,10 +1128,10 @@ IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetMetricEventDuration,
IPC_MESSAGE_ROUTED1(AutomationMsg_RequestGoToHistoryEntryOffset,
int) // numbers of entries (negative or positive)
-// Silently install the extension in the given crx file.
-IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_InstallExtension,
+// DEPRECATED MESSAGE.
+IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DEPRECATED_InstallExtension,
FilePath /* full path to crx file */,
- AutomationMsg_ExtensionResponseValues)
+ int)
// DEPRECATED MESSAGE - But we must leave this comment and message so as
// not to perturb line numbers (see comment at top of file re __LINE__).
@@ -1300,12 +1300,12 @@ IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest,
std::string /* JSON response */,
bool /* success */)
-// Installs an extension from the crx file and returns its id.
-// On error, |extension handle| will be 0.
-IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_InstallExtensionAndGetHandle,
- FilePath /* full path to crx file */,
- bool /* with UI */,
- int /* extension handle */)
+// Installs an extension from a crx file or unpacked extension folder
+// and returns its id. On error, |extension handle| will be 0.
+IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_InstallExtension,
+ FilePath /* full path to crx or unpacked dir */,
+ bool /* with UI */,
+ int /* extension handle */)
// Waits for the next extension test result. Sets |test result| as the
// received result and |message| as any accompanying message with the
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 5c12a70..4704deb 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -235,10 +235,10 @@ bool AutomationProxy::SavePackageShouldPromptUser(bool should_prompt) {
}
scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension(
- const FilePath& crx_file, bool with_ui) {
+ const FilePath& extension_path, bool with_ui) {
int handle = 0;
- if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(crx_file, with_ui,
- &handle)))
+ if (!Send(new AutomationMsg_InstallExtension(extension_path,
+ with_ui, &handle)))
return NULL;
return ProxyObjectFromHandle<ExtensionProxy>(handle);
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 0390f03..a41689d 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -197,11 +197,11 @@ class AutomationProxy : public IPC::Channel::Listener,
// sent.
bool SavePackageShouldPromptUser(bool should_prompt) WARN_UNUSED_RESULT;
- // Installs the extension crx. If |with_ui| is true an install confirmation
+ // Installs the extension. If |with_ui| is true an install confirmation
// and notification UI is shown, otherwise the install is silent. Returns the
// ExtensionProxy for the installed extension, or NULL on failure.
// Note: Overinstalls and downgrades will return NULL.
- scoped_refptr<ExtensionProxy> InstallExtension(const FilePath& crx_file,
+ scoped_refptr<ExtensionProxy> InstallExtension(const FilePath& extension_path,
bool with_ui);
// Asserts that the next extension test result is true.
diff --git a/chrome/test/functional/chromeos_security.py b/chrome/test/functional/chromeos_security.py
index 2788cee..acbb54f 100644
--- a/chrome/test/functional/chromeos_security.py
+++ b/chrome/test/functional/chromeos_security.py
@@ -170,10 +170,9 @@ class ChromeosSecurity(pyauto.PyUITest):
self.assertTrue(
file_name in [x['crx_file'] for x in self._bundled_crx_baseline],
msg='Unexpected CRX file: ' + file_name)
- crx_file = pyauto.FilePath(
- os.path.join(self._bundled_crx_directory, file_name))
+ crx_file = os.path.join(self._bundled_crx_directory, file_name)
self.assertTrue(self.InstallExtension(crx_file, False),
- msg='Extension install failed: %s' % crx_file.value())
+ msg='Extension install failed: %s' % crx_file)
# Verify that the permissions information in the baseline matches the
# permissions associated with the installed bundled CRX extensions.
@@ -184,10 +183,9 @@ class ChromeosSecurity(pyauto.PyUITest):
# Install all bundled extensions on the device.
for file_name in os.listdir(self._bundled_crx_directory):
if file_name.endswith('.crx'):
- crx_file = pyauto.FilePath(
- os.path.join(self._bundled_crx_directory, file_name))
+ crx_file = os.path.join(self._bundled_crx_directory, file_name)
self.assertTrue(self.InstallExtension(crx_file, False),
- msg='Extension install failed: %s' % crx_file.value())
+ msg='Extension install failed: %s' % crx_file)
# Ensure that the set of installed extension names precisely matches the
# baseline.
diff --git a/chrome/test/functional/extensions.py b/chrome/test/functional/extensions.py
index 8a40848..1332101 100644
--- a/chrome/test/functional/extensions.py
+++ b/chrome/test/functional/extensions.py
@@ -64,7 +64,7 @@ class ExtensionsTest(pyauto.PyUITest):
group_end = curr_extension + group_size
for extension in extensions[curr_extension:group_end]:
logging.debug('Installing extension: %s' % extension)
- self.InstallExtension(pyauto.FilePath(extension), False)
+ self.InstallExtension(extension, False)
for url in top_urls:
self.NavigateToURL(url)
@@ -157,7 +157,7 @@ class ExtensionsTest(pyauto.PyUITest):
"""Test setting different extension states."""
crx_file_path = os.path.abspath(
os.path.join(self.DataDir(), 'extensions', 'google_talk.crx'))
- ext_id = self.InstallExtension(pyauto.FilePath(crx_file_path), False);
+ ext_id = self.InstallExtension(crx_file_path, False);
self.assertTrue(ext_id, 'Failed to install extension.')
# Verify extension is in default state.
diff --git a/chrome/test/functional/memory.py b/chrome/test/functional/memory.py
index da32824..a06eb23 100644
--- a/chrome/test/functional/memory.py
+++ b/chrome/test/functional/memory.py
@@ -40,9 +40,8 @@ class MemoryTest(pyauto.PyUITest):
RENDERER_PROCESS_OUTPUT_FILE = 'renderer_process_mem.txt'
# Constants for testExtensionProcessMemoryUsage.
- EXTENSION_LOCATION = pyauto.FilePath(
- os.path.abspath(os.path.join(pyauto.PyUITest.DataDir(), 'extensions',
- 'google_talk.crx')))
+ EXTENSION_LOCATION = os.path.abspath(os.path.join(
+ pyauto.PyUITest.DataDir(), 'extensions', 'google_talk.crx'))
EXTENSION_PROCESS_NAME = 'Google Talk'
EXTENSION_PROCESS_OUTPUT_FILE = 'extension_process_mem.txt'
diff --git a/chrome/test/functional/ntp.py b/chrome/test/functional/ntp.py
index 78f41a1..96941c0 100644
--- a/chrome/test/functional/ntp.py
+++ b/chrome/test/functional/ntp.py
@@ -370,9 +370,8 @@ class NTPTest(pyauto.PyUITest):
Returns:
The string ID of the installed app.
"""
- app_crx_file = pyauto.FilePath(
- os.path.abspath(os.path.join(self.DataDir(), 'pyauto_private', 'apps',
- 'countdown.crx')))
+ app_crx_file = os.path.abspath(os.path.join(
+ self.DataDir(), 'pyauto_private', 'apps', 'countdown.crx'))
installed_app_id = self.InstallApp(app_crx_file)
self.assertTrue(installed_app_id, msg='App install failed.')
return installed_app_id
@@ -397,14 +396,12 @@ class NTPTest(pyauto.PyUITest):
def testGetAppsWhenInstallNonApps(self):
"""Ensures installed non-apps are not reflected in the NTP app info."""
# Install a regular extension and a theme.
- ext_crx_file = pyauto.FilePath(
- os.path.abspath(os.path.join(self.DataDir(), 'extensions',
- 'page_action.crx')))
+ ext_crx_file = os.path.abspath(os.path.join(self.DataDir(), 'extensions',
+ 'page_action.crx'))
self.assertTrue(self.InstallExtension(ext_crx_file, False),
msg='Extension install failed.')
- theme_crx_file = pyauto.FilePath(
- os.path.abspath(os.path.join(self.DataDir(), 'extensions',
- 'theme.crx')))
+ theme_crx_file = os.path.abspath(os.path.join(self.DataDir(), 'extensions',
+ 'theme.crx'))
self.assertTrue(self.SetTheme(theme_crx_file), msg='Theme install failed.')
# Verify that no apps are listed on the NTP except for the Web Store.
app_info = self.GetNTPApps()
diff --git a/chrome/test/functional/themes.py b/chrome/test/functional/themes.py
index 5ae904f..298eec6 100644
--- a/chrome/test/functional/themes.py
+++ b/chrome/test/functional/themes.py
@@ -30,7 +30,7 @@ class ThemesTest(pyauto.PyUITest):
self.assertFalse(self.GetThemeInfo()) # Verify there's no theme at startup
crx_file = os.path.abspath(
os.path.join(self.DataDir(), 'extensions', 'theme.crx'))
- self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file)))
+ self.assertTrue(self.SetTheme(crx_file))
# Verify "theme installed" infobar shows up
self.assertTrue(self.WaitForInfobarCount(1))
theme = self.GetThemeInfo()
@@ -43,7 +43,7 @@ class ThemesTest(pyauto.PyUITest):
self.assertFalse(self.GetThemeInfo()) # Verify there's no theme at startup
crx_file = os.path.abspath(
os.path.join(self.DataDir(), 'extensions', 'theme.crx'))
- self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file)))
+ self.assertTrue(self.SetTheme(crx_file))
# Verify "theme installed" infobar shows up
self.assertTrue(self.WaitForInfobarCount(1))
theme = self.GetThemeInfo()
@@ -53,7 +53,7 @@ class ThemesTest(pyauto.PyUITest):
"""Verify theme reset."""
crx_file = os.path.abspath(
os.path.join(self.DataDir(), 'extensions', 'theme.crx'))
- self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file)))
+ self.assertTrue(self.SetTheme(crx_file))
self.assertTrue(self.ResetToDefaultTheme())
self.assertFalse(self.GetThemeInfo())
@@ -80,7 +80,7 @@ class ThemesTest(pyauto.PyUITest):
# Apply each theme in this group.
for theme in this_group:
logging.debug('Applying theme: %s' % theme)
- self.assertTrue(self.SetTheme(pyauto.FilePath(theme)),
+ self.assertTrue(self.SetTheme(theme),
'Theme %s not installed.' % theme)
for url in urls:
@@ -138,4 +138,3 @@ class ThemesTest(pyauto.PyUITest):
if __name__ == '__main__':
pyauto_functional.Main()
-
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index 3db59eb..fcccbf5 100644
--- a/chrome/test/pyautolib/pyautolib.cc
+++ b/chrome/test/pyautolib/pyautolib.cc
@@ -202,10 +202,15 @@ int PyUITestBase::GetBrowserWindowCount() {
return num_windows;
}
-std::string PyUITestBase::InstallExtension(const FilePath& crx_file,
+std::string PyUITestBase::InstallExtension(const std::string& extension_path,
bool with_ui) {
+#if defined(OS_WIN)
+ FilePath extension_file_path = FilePath(ASCIIToWide(extension_path));
+#else
+ FilePath extension_file_path = FilePath(extension_path);
+#endif
scoped_refptr<ExtensionProxy> proxy =
- automation()->InstallExtension(crx_file, with_ui);
+ automation()->InstallExtension(extension_file_path, with_ui);
std::string id;
if (!proxy.get() || !proxy.get()->GetId(&id))
return "";
diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h
index fc22f22..1c21827 100644
--- a/chrome/test/pyautolib/pyautolib.h
+++ b/chrome/test/pyautolib/pyautolib.h
@@ -122,10 +122,10 @@ class PyUITestBase : public UITestBase {
// Fetch the number of browser windows. Includes popups.
int GetBrowserWindowCount();
- // Installs the extension crx. Returns the extension ID only if the extension
+ // Installs the extension. Returns the extension ID only if the extension
// was installed and loaded successfully. Otherwise, returns the empty
// string. Overinstalls will fail.
- std::string InstallExtension(const FilePath& crx_file, bool with_ui);
+ std::string InstallExtension(const std::string& extension_path, bool with_ui);
// Returns bookmark bar visibility state.
bool GetBookmarkBarVisibility();
diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i
index e0f5c9a..91d6023 100644
--- a/chrome/test/pyautolib/pyautolib.i
+++ b/chrome/test/pyautolib/pyautolib.i
@@ -372,11 +372,11 @@ class PyUITestBase {
int tab_index=0);
// Misc methods
- %feature("docstring", "Install an extension from the given file. The file "
- "must be specified with an absolute path. Returns the extension ID "
- "if successfully installed and loaded. Otherwise, returns the empty "
- "string.") InstallExtension;
- std::string InstallExtension(const FilePath& crx_file, bool with_ui);
+ %feature("docstring", "Install an extension from the given path. The path "
+ "must be absolute and may be a crx file or an unpacked extension "
+ "directory. Returns the extension ID if successfully installed and "
+ "loaded. Otherwise, returns the empty string.") InstallExtension;
+ std::string InstallExtension(const std::string& extension_path, bool with_ui);
%feature("docstring", "Get a proxy to the browser window at the given "
"zero-based index.") GetBrowserWindow;