| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/login/profile_auth_data.h" | 5 #include "chrome/browser/chromeos/login/profile_auth_data.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "net/test/channel_id_test_util.h" | 32 #include "net/test/channel_id_test_util.h" |
| 33 #include "net/url_request/url_request_context.h" | 33 #include "net/url_request/url_request_context.h" |
| 34 #include "net/url_request/url_request_context_getter.h" | 34 #include "net/url_request/url_request_context_getter.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "url/gurl.h" | 36 #include "url/gurl.h" |
| 37 | 37 |
| 38 namespace chromeos { | 38 namespace chromeos { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const char kProxyAuthURL[] = "http://example.com/"; | 42 const char kProxyAuthURL[] = "https://example.com/"; |
| 43 const char kProxyAuthRealm[] = "realm"; | 43 const char kProxyAuthRealm[] = "realm"; |
| 44 const char kProxyAuthChallenge[] = "challenge"; | 44 const char kProxyAuthChallenge[] = "challenge"; |
| 45 const char kProxyAuthPassword1[] = "password 1"; | 45 const char kProxyAuthPassword1[] = "password 1"; |
| 46 const char kProxyAuthPassword2[] = "password 2"; | 46 const char kProxyAuthPassword2[] = "password 2"; |
| 47 | 47 |
| 48 const char kGAIACookieURL[] = "http://google.com/"; | 48 const char kGAIACookieURL[] = "https://google.com/"; |
| 49 const char kSAMLIdPCookieURL[] = "http://example.com/"; | 49 const char kSAMLIdPCookieURL[] = "https://example.com/"; |
| 50 const char kCookieName[] = "cookie"; | 50 const char kCookieName[] = "cookie"; |
| 51 const char kCookieValue1[] = "value 1"; | 51 const char kCookieValue1[] = "value 1"; |
| 52 const char kCookieValue2[] = "value 2"; | 52 const char kCookieValue2[] = "value 2"; |
| 53 const char kGAIACookieDomain[] = "google.com"; | 53 const char kGAIACookieDomain[] = "google.com"; |
| 54 const char kSAMLIdPCookieDomain[] = "example.com"; | 54 const char kSAMLIdPCookieDomain[] = "example.com"; |
| 55 const char kSAMLIdPCookieDomainWithWildcard[] = ".example.com"; | 55 const char kSAMLIdPCookieDomainWithWildcard[] = ".example.com"; |
| 56 | 56 |
| 57 const char kChannelIDServerIdentifier[] = "server"; | 57 const char kChannelIDServerIdentifier[] = "server"; |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // Ensure |cookies| is fully initialized. | 221 // Ensure |cookies| is fully initialized. |
| 222 run_loop_.reset(new base::RunLoop); | 222 run_loop_.reset(new base::RunLoop); |
| 223 cookies->GetAllCookiesAsync(base::Bind(&ProfileAuthDataTest::QuitLoop, | 223 cookies->GetAllCookiesAsync(base::Bind(&ProfileAuthDataTest::QuitLoop, |
| 224 base::Unretained(this))); | 224 base::Unretained(this))); |
| 225 run_loop_->Run(); | 225 run_loop_->Run(); |
| 226 | 226 |
| 227 cookies->SetCookieWithDetailsAsync( | 227 cookies->SetCookieWithDetailsAsync( |
| 228 GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, | 228 GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, |
| 229 kSAMLIdPCookieDomainWithWildcard, std::string(), base::Time(), | 229 kSAMLIdPCookieDomainWithWildcard, std::string(), base::Time(), |
| 230 base::Time(), base::Time(), true, false, | 230 base::Time(), base::Time(), true, false, |
| 231 net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT, | 231 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT, |
| 232 net::CookieStore::SetCookiesCallback()); | 232 net::CookieStore::SetCookiesCallback()); |
| 233 cookies->SetCookieWithDetailsAsync( | 233 cookies->SetCookieWithDetailsAsync( |
| 234 GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, std::string(), | 234 GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, std::string(), |
| 235 std::string(), base::Time(), base::Time(), base::Time(), true, false, | 235 std::string(), base::Time(), base::Time(), base::Time(), true, false, |
| 236 net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT, | 236 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT, |
| 237 net::CookieStore::SetCookiesCallback()); | 237 net::CookieStore::SetCookiesCallback()); |
| 238 cookies->SetCookieWithDetailsAsync( | 238 cookies->SetCookieWithDetailsAsync( |
| 239 GURL(kGAIACookieURL), kCookieName, cookie_value, std::string(), | 239 GURL(kGAIACookieURL), kCookieName, cookie_value, std::string(), |
| 240 std::string(), base::Time(), base::Time(), base::Time(), true, false, | 240 std::string(), base::Time(), base::Time(), base::Time(), true, false, |
| 241 net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT, | 241 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT, |
| 242 net::CookieStore::SetCookiesCallback()); | 242 net::CookieStore::SetCookiesCallback()); |
| 243 | 243 |
| 244 GetChannelIDs(browser_context) | 244 GetChannelIDs(browser_context) |
| 245 ->SetChannelID(base::MakeUnique<net::ChannelIDStore::ChannelID>( | 245 ->SetChannelID(base::MakeUnique<net::ChannelIDStore::ChannelID>( |
| 246 kChannelIDServerIdentifier, base::Time(), std::move(channel_id_key))); | 246 kChannelIDServerIdentifier, base::Time(), std::move(channel_id_key))); |
| 247 } | 247 } |
| 248 | 248 |
| 249 net::URLRequestContext* ProfileAuthDataTest::GetRequestContext( | 249 net::URLRequestContext* ProfileAuthDataTest::GetRequestContext( |
| 250 content::BrowserContext* browser_context) { | 250 content::BrowserContext* browser_context) { |
| 251 return content::BrowserContext::GetDefaultStoragePartition(browser_context)-> | 251 return content::BrowserContext::GetDefaultStoragePartition(browser_context)-> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 PopulateUserBrowserContext(); | 326 PopulateUserBrowserContext(); |
| 327 | 327 |
| 328 Transfer(false, true); | 328 Transfer(false, true); |
| 329 | 329 |
| 330 VerifyTransferredUserProxyAuthEntry(); | 330 VerifyTransferredUserProxyAuthEntry(); |
| 331 VerifyUserCookies(kCookieValue2, kCookieValue1); | 331 VerifyUserCookies(kCookieValue2, kCookieValue1); |
| 332 VerifyUserChannelID(channel_id_key2_.get()); | 332 VerifyUserChannelID(channel_id_key2_.get()); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace chromeos | 335 } // namespace chromeos |
| OLD | NEW |