Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1053)

Unified Diff: content/browser/renderer_host/resource_dispatcher_host_browsertest.cc

Issue 10875045: Rewrite the cookies pyauto test as browser tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/functional/cookies.py ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/resource_dispatcher_host_browsertest.cc
===================================================================
--- content/browser/renderer_host/resource_dispatcher_host_browsertest.cc (revision 153070)
+++ content/browser/renderer_host/resource_dispatcher_host_browsertest.cc (working copy)
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/string_util.h"
-#include "base/synchronization/waitable_event.h"
#include "base/utf_string_conversions.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -22,36 +21,10 @@
#include "content/test/net/url_request_failed_job.h"
#include "content/test/net/url_request_mock_http_job.h"
#include "net/base/net_errors.h"
-#include "net/cookies/cookie_store.h"
#include "net/test/test_server.h"
-#include "net/url_request/url_request_context.h"
-#include "net/url_request/url_request_context_getter.h"
namespace content {
-namespace {
-
-void GetCookiesCallback(std::string* cookies_out,
- base::WaitableEvent* event,
- const std::string& cookies) {
- *cookies_out = cookies;
- event->Signal();
-}
-
-void GetCookiesOnIOThread(const GURL& url,
- net::URLRequestContextGetter* context_getter,
- base::WaitableEvent* event,
- std::string* cookies) {
- net::CookieStore* cookie_store =
- context_getter->GetURLRequestContext()->cookie_store();
- cookie_store->GetCookiesWithOptionsAsync(
- url, net::CookieOptions(),
- base::Bind(&GetCookiesCallback,
- base::Unretained(cookies), base::Unretained(event)));
-}
-
-} // namespace
-
class ResourceDispatcherHostBrowserTest : public ContentBrowserTest,
public DownloadManager::Observer {
public:
@@ -104,17 +77,8 @@
}
std::string GetCookies(const GURL& url) {
- std::string cookies;
- base::WaitableEvent event(true, false);
- net::URLRequestContextGetter* context_getter =
- shell()->web_contents()->GetBrowserContext()->GetRequestContext();
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&GetCookiesOnIOThread, url,
- make_scoped_refptr(context_getter), &event, &cookies));
- event.Wait();
- return cookies;
+ return content::GetCookies(
+ shell()->web_contents()->GetBrowserContext(), url);
}
bool got_downloads() const { return got_downloads_; }
« no previous file with comments | « chrome/test/functional/cookies.py ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698