| 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" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/cookie_options.h" | 13 #include "net/base/cookie_options.h" |
| 14 #include "net/base/cookie_store.h" | 14 #include "net/base/cookie_store.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace chromeos { |
| 18 |
| 17 typedef testing::Test ExternalCookieHandlerTest; | 19 typedef testing::Test ExternalCookieHandlerTest; |
| 18 | 20 |
| 19 static const std::string cookie1 = "coookie1\n"; | 21 static const std::string cookie1 = "coookie1\n"; |
| 20 static const std::string cookie2 = "coookie2\n"; | 22 static const std::string cookie2 = "coookie2\n"; |
| 21 static const std::string cookie3 = "coookie3"; | 23 static const std::string cookie3 = "coookie3"; |
| 22 | 24 |
| 23 class MockCookieStore : public net::CookieStore { | 25 class MockCookieStore : public net::CookieStore { |
| 24 public: | 26 public: |
| 25 MockCookieStore() : expected_url_(ExternalCookieHandler::kGoogleAccountsUrl) { | 27 MockCookieStore() : expected_url_(ExternalCookieHandler::kGoogleAccountsUrl) { |
| 26 cookies_.insert(cookie1); | 28 cookies_.insert(cookie1); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 std::vector<std::string> cookies; | 146 std::vector<std::string> cookies; |
| 145 cookies.push_back(cookie3); | 147 cookies.push_back(cookie3); |
| 146 cookies.push_back(cookie2.substr(2)); | 148 cookies.push_back(cookie2.substr(2)); |
| 147 cookies.push_back(cookie2.substr(0, 2)); | 149 cookies.push_back(cookie2.substr(0, 2)); |
| 148 cookies.push_back(cookie1); | 150 cookies.push_back(cookie1); |
| 149 MockReader *reader = new MockReader(cookies); | 151 MockReader *reader = new MockReader(cookies); |
| 150 | 152 |
| 151 ExternalCookieHandler handler(reader); // takes ownership. | 153 ExternalCookieHandler handler(reader); // takes ownership. |
| 152 EXPECT_TRUE(handler.HandleCookies(cookie_store.get())); | 154 EXPECT_TRUE(handler.HandleCookies(cookie_store.get())); |
| 153 } | 155 } |
| 156 |
| 157 } // namespace chromeos |
| OLD | NEW |