summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automation/automation_messages_internal.h45
-rw-r--r--chrome/test/automation/browser_proxy.cc20
-rw-r--r--chrome/test/automation/browser_proxy.h3
-rw-r--r--chrome/test/automation/tab_proxy.cc76
-rw-r--r--chrome/test/automation/tab_proxy.h29
-rw-r--r--chrome/test/data/ssl/bad_iframe.html9
-rw-r--r--chrome/test/data/ssl/frame_left.html7
-rw-r--r--chrome/test/data/ssl/frame_right.html3
-rw-r--r--chrome/test/data/ssl/page_with_mixed_contents.html10
-rw-r--r--chrome/test/data/ssl/top_frame.html25
10 files changed, 214 insertions, 13 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index aed439e..e6cf72a 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -27,8 +27,8 @@
// The IPC message IDs are part of an enum and hence the value
// assumed to be constant across the builds may change.
// The messages AutomationMsg_WindowHWND* in particular should not change
-// since the PageCyclerReferenceTest depend on the correctness of the
-// the message IDs across the builds.
+// since the PageCyclerReferenceTest depends on the correctness of the
+// message IDs across the builds.
// By using a start value of 0 for automation messages, we keep backward
// compatability with old builds.
@@ -760,5 +760,46 @@ IPC_BEGIN_MESSAGES(Automation, 0)
IPC_MESSAGE_ROUTED2(AutomationMsg_BookmarkBarVisibilityResponse,
bool, /* is_visible */
bool /* still_animating */)
+
+ // This message requests the number of SSL related info bars opened. It
+ // returns -1 if an error occurred.
+ IPC_MESSAGE_ROUTED1(AutomationMsg_GetSSLInfoBarCountRequest,
+ int /* tab_handle */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_GetSSLInfoBarCountResponse,
+ int /* info bar count */)
+
+ // This message triggers the action associated with the link in the info-bar
+ // at the specified index. If |wait for navigation| is true, it won't return
+ // until a navigation has occurred.
+ IPC_MESSAGE_ROUTED3(AutomationMsg_ClickSSLInfoBarLinkRequest,
+ int /* tab_handle */,
+ int /* info bar index */,
+ bool /* wait for navigation */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_ClickSSLInfoBarLinkResponse,
+ bool /* success flag */)
+
+ // This message retrieves the last time a navigation occurred in the specified
+ // tab. The value is intended to be used with WaitForNavigation.
+ IPC_MESSAGE_ROUTED1(AutomationMsg_GetLastNavigationTimeRequest,
+ int /* tab_handle */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_GetLastNavigationTimeResponse,
+ int64 /* last navigation time */)
+
+ // This messages is used to block until a new navigation occurs (if there is
+ // none more recent then the time specified).
+ IPC_MESSAGE_ROUTED2(AutomationMsg_WaitForNavigationRequest,
+ int /* tab_handle */,
+ int64 /* last navigation time */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_WaitForNavigationResponse,
+ bool /* success */)
+
+ // This messages sets an int-value preference.
+ IPC_MESSAGE_ROUTED3(AutomationMsg_SetIntPreferenceRequest,
+ int /* browser handle */,
+ std::wstring /* pref name */,
+ int /* value */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_SetIntPreferenceResponse,
+ bool /* success */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 425c6b5..8a30c31 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -372,3 +372,23 @@ bool BrowserProxy::GetBookmarkBarVisibility(bool* is_visible,
delete response;
return true;
}
+
+bool BrowserProxy::SetIntPreference(const std::wstring& name, int value) {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool success = sender_->SendAndWaitForResponse(
+ new AutomationMsg_SetIntPreferenceRequest(0, handle_, name , value),
+ &response, AutomationMsg_SetIntPreferenceResponse::ID);
+
+ scoped_ptr<IPC::Message> response_deleter(response); // Delete on return.
+ if (!success)
+ return false;
+
+ if (AutomationMsg_SetIntPreferenceResponse::Read(response, &success))
+ return success;
+
+ // We failed to deserialize the returned value.
+ return false;
+} \ No newline at end of file
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 133a93d2..b2c92ca 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -143,6 +143,9 @@ class BrowserProxy : public AutomationResourceProxy {
// it into position. Returns false on failure.
bool GetBookmarkBarVisibility(bool* is_visible, bool* is_animating);
+ // Sets the int value of the specified preference.
+ bool SetIntPreference(const std::wstring& name, int value);
+
private:
DISALLOW_COPY_AND_ASSIGN(BrowserProxy);
};
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index f284b26..7668c19 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -966,3 +966,79 @@ void TabProxy::HandleMessageFromExternalHost(AutomationHandle handle,
DCHECK(succeeded);
}
+bool TabProxy::GetSSLInfoBarCount(int* count) {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool success = sender_->SendAndWaitForResponse(
+ new AutomationMsg_GetSSLInfoBarCountRequest(0, handle_),
+ &response,
+ AutomationMsg_GetSSLInfoBarCountResponse::ID);
+ scoped_ptr<IPC::Message> auto_deleter(response);
+ if (!success)
+ return false;
+
+ void* iter = NULL;
+ response->ReadInt(&iter, count);
+ return true;
+}
+
+bool TabProxy::ClickSSLInfoBarLink(int info_bar_index,
+ bool wait_for_navigation) {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool success = sender_->SendAndWaitForResponse(
+ new AutomationMsg_ClickSSLInfoBarLinkRequest(0, handle_,
+ info_bar_index,
+ wait_for_navigation),
+ &response,
+ AutomationMsg_ClickSSLInfoBarLinkResponse::ID);
+ scoped_ptr<IPC::Message> auto_deleter(response);
+ if (!success)
+ return false;
+
+ void* iter = NULL;
+ response->ReadBool(&iter, &success);
+ return success;
+}
+
+bool TabProxy::GetLastNavigationTime(int64* last_navigation_time) {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool success = sender_->SendAndWaitForResponse(
+ new AutomationMsg_GetLastNavigationTimeRequest(0, handle_),
+ &response,
+ AutomationMsg_GetLastNavigationTimeResponse::ID);
+ scoped_ptr<IPC::Message> auto_deleter(response);
+ if (!success)
+ return false;
+
+ void* iter = NULL;
+ response->ReadInt64(&iter, last_navigation_time);
+ return true;
+}
+
+bool TabProxy::WaitForNavigation(int64 last_navigation_time) {
+ if (!is_valid())
+ return false;
+
+ IPC::Message* response = NULL;
+ bool success = sender_->SendAndWaitForResponse(
+ new AutomationMsg_WaitForNavigationRequest(0,
+ handle_,
+ last_navigation_time),
+ &response,
+ AutomationMsg_WaitForNavigationResponse::ID);
+ scoped_ptr<IPC::Message> auto_deleter(response);
+ if (!success)
+ return false;
+
+ void* iter = NULL;
+ response->ReadBool(&iter, &success);
+ return success;
+} \ No newline at end of file
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 220d096..a13e6a5 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -44,10 +44,9 @@ class TabProxy : public AutomationResourceProxy {
// failure.
ConstrainedWindowProxy* GetConstrainedWindow(int window_index) const;
- // Execute a javascript in a frame's context whose xpath
- // is provided as the first parameter and extract
- // the values from the resulting json string.
- // Example:
+ // Executes a javascript in a frame's context whose xpath is provided as the
+ // first parameter and extract the values from the resulting json string.
+ // Examples:
// jscript = "window.domAutomationController.send('string');"
// will result in value = "string"
// jscript = "window.domAutomationController.send(24);"
@@ -254,6 +253,28 @@ class TabProxy : public AutomationResourceProxy {
const std::string& target,
const std::string& message);
+ // Retrieves the number of SSL related info-bars currently showing in |count|.
+ bool GetSSLInfoBarCount(int* count);
+
+ // Causes a click on the link of the info-bar at |info_bar_index|. If
+ // |wait_for_navigation| is true, this call does not return until a navigation
+ // has occured.
+ bool ClickSSLInfoBarLink(int info_bar_index, bool wait_for_navigation);
+
+ // Retrieves the time at which the last navigation occured. This is intended
+ // to be used with WaitForNavigation (see below).
+ bool GetLastNavigationTime(int64* last_navigation_time);
+
+ // Waits for a new navigation if none as occurred since |last_navigation_time|
+ // The purpose of this function is for operations that causes asynchronous
+ // navigation to happen.
+ // It is supposed to be used as follow:
+ // int64 last_nav_time;
+ // tab_proxy->GetLastNavigationTime(&last_nav_time);
+ // tab_proxy->SomeOperationThatTriggersAnAsynchronousNavigation();
+ // tab_proxy->WaitForNavigation(last_nav_time);
+ bool WaitForNavigation(int64 last_navigation_time);
+
private:
DISALLOW_COPY_AND_ASSIGN(TabProxy);
};
diff --git a/chrome/test/data/ssl/bad_iframe.html b/chrome/test/data/ssl/bad_iframe.html
index 53eff7e..b20481c 100644
--- a/chrome/test/data/ssl/bad_iframe.html
+++ b/chrome/test/data/ssl/bad_iframe.html
@@ -1,10 +1,9 @@
<html>
-<script>
- window.open('google.html', name,
- "status = 1, height = 300, width = 300, resizable = 0" );
-</script>
-
+<body>
<H1>Evil IFrame</H1>
+<div id="evilDiv">
This frame is loaded over insecure HTTPS.
+</div>
+</body>
</html>
diff --git a/chrome/test/data/ssl/frame_left.html b/chrome/test/data/ssl/frame_left.html
new file mode 100644
index 0000000..128d69e
--- /dev/null
+++ b/chrome/test/data/ssl/frame_left.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+<a id="goodHTTPSLink" href="https://127.0.0.1:9443/files/ssl/google.html" TARGET="contentFrame">Good HTTPS page</a><br>
+<a id="badHTTPSLink" href="https://127.0.0.1:9666/files/ssl/bad_iframe.html" TARGET="contentFrame">Bad HTTPS page</a><br>
+<a id="HTTPLink" href="http://127.0.0.1:1337/files/ssl/google.html" TARGET="contentFrame">HTTP page</a><br>
+</body>
+</html>
diff --git a/chrome/test/data/ssl/frame_right.html b/chrome/test/data/ssl/frame_right.html
new file mode 100644
index 0000000..d49d61d9
--- /dev/null
+++ b/chrome/test/data/ssl/frame_right.html
@@ -0,0 +1,3 @@
+<html>
+This is the content frame.
+</html>
diff --git a/chrome/test/data/ssl/page_with_mixed_contents.html b/chrome/test/data/ssl/page_with_mixed_contents.html
index 2bf9bb24..b19730a 100644
--- a/chrome/test/data/ssl/page_with_mixed_contents.html
+++ b/chrome/test/data/ssl/page_with_mixed_contents.html
@@ -1,9 +1,15 @@
<html>
-<head><title>Page with mixed contents</title></head>
+<head><title>Page with mixed contents</title>
+<script>
+ function ImageWidth() {
+ return document.getElementById("bad_image").width;
+ }
+</script>
+</head>
<body>
This page contains an image which is served over an http connection,
causing mixed contents (when this page is loaded over https).<br>
-<img src="http://localhost:1337/files/ssl/google_files/logo.gif"/>
+<img id="bad_image" src="http://localhost:1337/files/ssl/google_files/logo.gif"/>
</body>
</html>
diff --git a/chrome/test/data/ssl/top_frame.html b/chrome/test/data/ssl/top_frame.html
new file mode 100644
index 0000000..ac5c144
--- /dev/null
+++ b/chrome/test/data/ssl/top_frame.html
@@ -0,0 +1,25 @@
+<html>
+ <head><title>This is a test page with frames</title>
+ <script>
+ function simulateClick(target) {
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, window,
+ 0, 0, 0, 0, 0, false, false,
+ false, false, 0, null);
+
+ return target.dispatchEvent(evt);
+ }
+
+ function clickLink(linkID) {
+ target = frames['navFrame'].document.getElementById(linkID);
+ if (target == null)
+ alert("clickLink failed for id=" + linkID);
+ return simulateClick(target);
+ }
+ </script>
+ </head>
+ <frameset cols="25%,75%">
+ <frame src="frame_left.html" name="navFrame">
+ <frame src="frame_right.html" name="contentFrame">
+ </frameset>
+</html>