diff options
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 7 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 9 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 7 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 9512969..77f9d56 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -1389,4 +1389,11 @@ IPC_BEGIN_MESSAGES(Automation) WindowOpenDisposition, bool /* result */) + + // This message requests the cookie be delete for given url in the + // profile of the tab identified by the first parameter. The second + // parameter is the cookie name. + IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_DeleteCookie, GURL, std::string, + int, bool) + IPC_END_MESSAGES(Automation) diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 9850d1f..2631f84 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -414,6 +414,15 @@ TEST_F(AutomationProxyTest, Cookies) { ASSERT_FALSE(value_result.empty()); EXPECT_TRUE(value_result.find("foo1=baz1") != std::string::npos); EXPECT_TRUE(value_result.find("foo2=baz2") != std::string::npos); + + // test deleting cookie + ASSERT_TRUE(tab->SetCookie(url, "foo3=deleteme")); + + ASSERT_TRUE(tab->GetCookieByName(url, "foo3", &value_result)); + ASSERT_FALSE(value_result.empty()); + ASSERT_STREQ("deleteme", value_result.c_str()); + + ASSERT_TRUE(tab->DeleteCookie(url, "foo3")); } TEST_F(AutomationProxyTest, NavigateToURLAsync) { diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index a662f60..0c2c27f 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -474,6 +474,13 @@ bool TabProxy::SetCookie(const GURL& url, const std::string& value) { &response_value)); } +bool TabProxy::DeleteCookie(const GURL& url, const std::string& name) { + bool succeeded; + sender_->Send(new AutomationMsg_DeleteCookie(0, url, name, handle_, + &succeeded)); + return succeeded; +} + int TabProxy::InspectElement(int x, int y) { if (!is_valid()) return -1; diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 7fabc50..3929213 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -251,6 +251,8 @@ class TabProxy : public AutomationResourceProxy, const std::string& name, std::string* cookies) WARN_UNUSED_RESULT; bool SetCookie(const GURL& url, const std::string& value) WARN_UNUSED_RESULT; + bool DeleteCookie(const GURL& url, + const std::string& name) WARN_UNUSED_RESULT; // Sends a InspectElement message for the current tab. |x| and |y| are the // coordinates that we want to simulate that the user is trying to inspect. |