| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/task.h" | 6 #include "base/task.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 std::string GetCookies(const GURL& url) { | 61 std::string GetCookies(const GURL& url) { |
| 62 std::string cookies; | 62 std::string cookies; |
| 63 base::WaitableEvent event(true /* manual reset */, | 63 base::WaitableEvent event(true /* manual reset */, |
| 64 false /* not initially signaled */); | 64 false /* not initially signaled */); |
| 65 net::URLRequestContextGetter* context_getter = | 65 net::URLRequestContextGetter* context_getter = |
| 66 browser()->profile()->GetRequestContext(); | 66 browser()->profile()->GetRequestContext(); |
| 67 EXPECT_TRUE( | 67 EXPECT_TRUE( |
| 68 BrowserThread::PostTask( | 68 BrowserThread::PostTask( |
| 69 BrowserThread::IO, FROM_HERE, | 69 BrowserThread::IO, FROM_HERE, |
| 70 new GetCookiesTask(url, context_getter, &event, &cookies))); | 70 new GetCookiesTask(url, context_getter, &event, &cookies))); |
| 71 EXPECT_TRUE(event.Wait()); | 71 event.Wait(); |
| 72 return cookies; | 72 return cookies; |
| 73 } | 73 } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(CookiePolicyBrowserTest); | 76 DISALLOW_COPY_AND_ASSIGN(CookiePolicyBrowserTest); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 // Visits a page that sets a first-party cookie. | 79 // Visits a page that sets a first-party cookie. |
| 80 IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, AllowFirstPartyCookies) { | 80 IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, AllowFirstPartyCookies) { |
| 81 ASSERT_TRUE(test_server()->Start()); | 81 ASSERT_TRUE(test_server()->Start()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 121 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 122 | 122 |
| 123 ui_test_utils::NavigateToURL(browser(), | 123 ui_test_utils::NavigateToURL(browser(), |
| 124 GURL(url.spec() + redirected_url.spec())); | 124 GURL(url.spec() + redirected_url.spec())); |
| 125 | 125 |
| 126 cookie = GetCookies(redirected_url); | 126 cookie = GetCookies(redirected_url); |
| 127 EXPECT_EQ("cookie2", cookie); | 127 EXPECT_EQ("cookie2", cookie); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| OLD | NEW |