| 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 "chrome/browser/browsing_data_cookie_helper.h" |    5 #include "chrome/browser/browsing_data_cookie_helper.h" | 
|    6  |    6  | 
|    7  |    7  | 
|    8 #include "base/bind.h" |    8 #include "base/bind.h" | 
|    9 #include "base/message_loop.h" |    9 #include "base/message_loop.h" | 
|   10 #include "base/synchronization/waitable_event.h" |   10 #include "base/synchronization/waitable_event.h" | 
|   11 #include "chrome/test/base/testing_profile.h" |   11 #include "chrome/test/base/testing_profile.h" | 
|   12 #include "content/test/test_browser_thread.h" |   12 #include "content/test/test_browser_thread.h" | 
|   13 #include "net/url_request/url_request_context_getter.h" |   13 #include "net/url_request/url_request_context_getter.h" | 
|   14 #include "testing/gtest/include/gtest/gtest.h" |   14 #include "testing/gtest/include/gtest/gtest.h" | 
|   15  |   15  | 
 |   16 using content::BrowserThread; | 
 |   17  | 
|   16 namespace { |   18 namespace { | 
|   17  |   19  | 
|   18 class BrowsingDataCookieHelperTest : public testing::Test { |   20 class BrowsingDataCookieHelperTest : public testing::Test { | 
|   19  public: |   21  public: | 
|   20   void SetUpOnIOThread(base::WaitableEvent* io_setup_complete) { |   22   void SetUpOnIOThread(base::WaitableEvent* io_setup_complete) { | 
|   21     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |   23     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 
|   22     // This is a workaround for a bug in the TestingProfile. |   24     // This is a workaround for a bug in the TestingProfile. | 
|   23     // The URLRequestContext will be created by GetCookieMonster on the UI |   25     // The URLRequestContext will be created by GetCookieMonster on the UI | 
|   24     // thread, if it does not already exist. But it must be created on the IO |   26     // thread, if it does not already exist. But it must be created on the IO | 
|   25     // thread or else it will DCHECK upon destruction. |   27     // thread or else it will DCHECK upon destruction. | 
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  195       new net::CookieMonster::CanonicalCookie(url_google, pc)); |  197       new net::CookieMonster::CanonicalCookie(url_google, pc)); | 
|  196   cookies.push_back(*cookie); |  198   cookies.push_back(*cookie); | 
|  197  |  199  | 
|  198   helper->AddReadCookies(url_google, cookies); |  200   helper->AddReadCookies(url_google, cookies); | 
|  199   ASSERT_FALSE(helper->empty()); |  201   ASSERT_FALSE(helper->empty()); | 
|  200   helper->Reset(); |  202   helper->Reset(); | 
|  201   ASSERT_TRUE(helper->empty()); |  203   ASSERT_TRUE(helper->empty()); | 
|  202 } |  204 } | 
|  203  |  205  | 
|  204 }  // namespace |  206 }  // namespace | 
| OLD | NEW |