summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc27
-rw-r--r--chrome/browser/automation/automation_provider.h2
-rw-r--r--chrome/test/automation/automation_messages_internal.h4
-rw-r--r--chrome/test/automation/tab_proxy.h9
4 files changed, 42 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index f7fef6b..38b732e 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -50,8 +50,10 @@
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/platform_util.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/test/automation/automation_messages.h"
+#include "chrome/test/automation/tab_proxy.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/url_request/url_request_context.h"
@@ -429,6 +431,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(AutomationMsg_ConnectExternalTab, ConnectExternalTab)
#endif
+ IPC_MESSAGE_HANDLER(AutomationMsg_SetPageFontSize, OnSetPageFontSize)
IPC_END_MESSAGE_MAP()
}
@@ -1966,6 +1969,30 @@ void AutomationProvider::StopAsync(int tab_handle) {
view->Stop();
}
+void AutomationProvider::OnSetPageFontSize(int tab_handle,
+ int font_size) {
+ AutomationPageFontSize automation_font_size =
+ static_cast<AutomationPageFontSize>(font_size);
+
+ if (automation_font_size < SMALLEST_FONT ||
+ automation_font_size > LARGEST_FONT) {
+ DLOG(ERROR) << "Invalid font size specified : "
+ << font_size;
+ return;
+ }
+
+ if (tab_tracker_->ContainsHandle(tab_handle)) {
+ NavigationController* tab = tab_tracker_->GetResource(tab_handle);
+ DCHECK(tab != NULL);
+ if (tab && tab->tab_contents()) {
+ DCHECK(tab->tab_contents()->profile() != NULL);
+ tab->tab_contents()->profile()->GetPrefs()->SetInteger(
+ prefs::kWebKitDefaultFontSize, font_size);
+ }
+ }
+}
+
+
void AutomationProvider::WaitForBrowserWindowCountToBecome(
int target_count, IPC::Message* reply_message) {
if (static_cast<int>(BrowserList::size()) == target_count) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 6b72395..ef1f228 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -299,6 +299,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
gfx::NativeWindow* tab_window,
int* tab_handle);
+ void OnSetPageFontSize(int tab_handle, int font_size);
+
void NavigateInExternalTab(
int handle, const GURL& url,
AutomationMsg_NavigationResponseValues* status);
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 5836ec6..c9d04dd 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1109,4 +1109,8 @@ IPC_BEGIN_MESSAGES(Automation)
// bool - true if query is successful
IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_IsWindowMaximized, int, bool, bool)
+ IPC_MESSAGE_ROUTED2(AutomationMsg_SetPageFontSize,
+ int /* tab_handle */,
+ int /* The font size */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 7209ada..b990d2e 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -29,6 +29,15 @@ class Message;
enum FindInPageDirection { BACK = 0, FWD = 1 };
enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 };
+// Specifies the font size on a page which is requested by an automation
+// client.
+enum AutomationPageFontSize {
+ SMALLEST_FONT = 8,
+ SMALL_FONT = 12,
+ MEDIUM_FONT = 16,
+ LARGE_FONT = 24,
+ LARGEST_FONT = 36
+};
class TabProxy : public AutomationResourceProxy {
public: