| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/process.h" | 14 #include "base/process.h" |
| 14 #include "base/scoped_temp_dir.h" | 15 #include "base/scoped_temp_dir.h" |
| 15 #include "base/string16.h" | 16 #include "base/string16.h" |
| 16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, | 95 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, |
| 95 const std::wstring& frame_xpath, | 96 const std::wstring& frame_xpath, |
| 96 const std::wstring& script, | 97 const std::wstring& script, |
| 97 bool* result) WARN_UNUSED_RESULT; | 98 bool* result) WARN_UNUSED_RESULT; |
| 98 bool ExecuteJavaScriptAndExtractString( | 99 bool ExecuteJavaScriptAndExtractString( |
| 99 RenderViewHost* render_view_host, | 100 RenderViewHost* render_view_host, |
| 100 const std::wstring& frame_xpath, | 101 const std::wstring& frame_xpath, |
| 101 const std::wstring& script, | 102 const std::wstring& script, |
| 102 std::string* result) WARN_UNUSED_RESULT; | 103 std::string* result) WARN_UNUSED_RESULT; |
| 103 | 104 |
| 104 // Returns the cookies for the given url. Runs a nested message loop. | 105 // Returns the cookies for the given url. |
| 105 std::string GetCookies(BrowserContext* browser_context, const GURL& url); | 106 std::string GetCookies(BrowserContext* browser_context, const GURL& url); |
| 106 | 107 |
| 108 // Sets a cookie for the given url. Returns true on success. |
| 109 bool SetCookie(BrowserContext* browser_context, |
| 110 const GURL& url, |
| 111 const std::string& value); |
| 112 |
| 107 // Watches title changes on a tab, blocking until an expected title is set. | 113 // Watches title changes on a tab, blocking until an expected title is set. |
| 108 class TitleWatcher : public NotificationObserver { | 114 class TitleWatcher : public NotificationObserver { |
| 109 public: | 115 public: |
| 110 // |web_contents| must be non-NULL and needs to stay alive for the | 116 // |web_contents| must be non-NULL and needs to stay alive for the |
| 111 // entire lifetime of |this|. |expected_title| is the title that |this| | 117 // entire lifetime of |this|. |expected_title| is the title that |this| |
| 112 // will wait for. | 118 // will wait for. |
| 113 TitleWatcher(WebContents* web_contents, | 119 TitleWatcher(WebContents* web_contents, |
| 114 const string16& expected_title); | 120 const string16& expected_title); |
| 115 virtual ~TitleWatcher(); | 121 virtual ~TitleWatcher(); |
| 116 | 122 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 208 |
| 203 // If the python websocket server serves with TLS. | 209 // If the python websocket server serves with TLS. |
| 204 bool secure_; | 210 bool secure_; |
| 205 | 211 |
| 206 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); | 212 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); |
| 207 }; | 213 }; |
| 208 | 214 |
| 209 } // namespace content | 215 } // namespace content |
| 210 | 216 |
| 211 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 217 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |