| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/chromeos/external_cookie_handler.h" | 5 #include "chrome/browser/chromeos/external_cookie_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual std::string GetCookies(const GURL& url) { | 76 virtual std::string GetCookies(const GURL& url) { |
| 77 EXPECT_TRUE(false); | 77 EXPECT_TRUE(false); |
| 78 return std::string(); | 78 return std::string(); |
| 79 } | 79 } |
| 80 virtual std::string GetCookiesWithOptions(const GURL& url, | 80 virtual std::string GetCookiesWithOptions(const GURL& url, |
| 81 const net::CookieOptions& options) { | 81 const net::CookieOptions& options) { |
| 82 EXPECT_TRUE(false); | 82 EXPECT_TRUE(false); |
| 83 return std::string(); | 83 return std::string(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 virtual void DeleteCookie(const GURL& url, |
| 87 const std::string& cookie_name) { |
| 88 EXPECT_TRUE(false); |
| 89 } |
| 90 |
| 86 private: | 91 private: |
| 87 std::set<std::string> cookies_; | 92 std::set<std::string> cookies_; |
| 88 const GURL expected_url_; | 93 const GURL expected_url_; |
| 89 | 94 |
| 90 DISALLOW_EVIL_CONSTRUCTORS(MockCookieStore); | 95 DISALLOW_EVIL_CONSTRUCTORS(MockCookieStore); |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 TEST_F(ExternalCookieHandlerTest, MockCookieStoreSanityTest) { | 98 TEST_F(ExternalCookieHandlerTest, MockCookieStoreSanityTest) { |
| 94 GURL url(ExternalCookieHandler::kGoogleAccountsUrl); | 99 GURL url(ExternalCookieHandler::kGoogleAccountsUrl); |
| 95 // Need to use a scoped_refptr here because net::CookieStore extends | 100 // Need to use a scoped_refptr here because net::CookieStore extends |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 cookies.push_back(cookie2.substr(2)); | 153 cookies.push_back(cookie2.substr(2)); |
| 149 cookies.push_back(cookie2.substr(0, 2)); | 154 cookies.push_back(cookie2.substr(0, 2)); |
| 150 cookies.push_back(cookie1); | 155 cookies.push_back(cookie1); |
| 151 MockReader *reader = new MockReader(cookies); | 156 MockReader *reader = new MockReader(cookies); |
| 152 | 157 |
| 153 ExternalCookieHandler handler(reader); // takes ownership. | 158 ExternalCookieHandler handler(reader); // takes ownership. |
| 154 EXPECT_TRUE(handler.HandleCookies(cookie_store.get())); | 159 EXPECT_TRUE(handler.HandleCookies(cookie_store.get())); |
| 155 } | 160 } |
| 156 | 161 |
| 157 } // namespace chromeos | 162 } // namespace chromeos |
| OLD | NEW |