| 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 // Tests common functionality used by the Chrome Extensions Cookies API | 5 // Tests common functionality used by the Chrome Extensions Cookies API |
| 6 // implementation. | 6 // implementation. |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/extensions/extension_cookies_api_constants.h" | 11 #include "chrome/browser/extensions/extension_cookies_api_constants.h" |
| 12 #include "chrome/browser/extensions/extension_cookies_helpers.h" | 12 #include "chrome/browser/extensions/extension_cookies_helpers.h" |
| 13 #include "chrome/test/base/testing_browser_process_test.h" | |
| 14 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 15 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 16 | 15 |
| 17 namespace keys = extension_cookies_api_constants; | 16 namespace keys = extension_cookies_api_constants; |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 struct DomainMatchCase { | 20 struct DomainMatchCase { |
| 22 const char* filter; | 21 const char* filter; |
| 23 const char* domain; | 22 const char* domain; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void set_linked_profile(OtrTestingProfile* profile) { | 54 void set_linked_profile(OtrTestingProfile* profile) { |
| 56 linked_profile_ = profile; | 55 linked_profile_ = profile; |
| 57 } | 56 } |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 OtrTestingProfile* linked_profile_; | 59 OtrTestingProfile* linked_profile_; |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 } // namespace | 62 } // namespace |
| 64 | 63 |
| 65 class ExtensionCookiesTest : public TestingBrowserProcessTest { | 64 class ExtensionCookiesTest : public testing::Test { |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { | 67 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { |
| 69 OtrTestingProfile profile, otrProfile; | 68 OtrTestingProfile profile, otrProfile; |
| 70 otrProfile.set_incognito(true); | 69 otrProfile.set_incognito(true); |
| 71 OtrTestingProfile::LinkProfiles(&profile, &otrProfile); | 70 OtrTestingProfile::LinkProfiles(&profile, &otrProfile); |
| 72 | 71 |
| 73 EXPECT_EQ(std::string("0"), | 72 EXPECT_EQ(std::string("0"), |
| 74 extension_cookies_helpers::GetStoreIdFromProfile(&profile)); | 73 extension_cookies_helpers::GetStoreIdFromProfile(&profile)); |
| 75 EXPECT_EQ(&profile, | 74 EXPECT_EQ(&profile, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 for (size_t i = 0; i < arraysize(tests); ++i) { | 204 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 206 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); | 205 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); |
| 207 extension_cookies_helpers::MatchFilter filter(details.get()); | 206 extension_cookies_helpers::MatchFilter filter(details.get()); |
| 208 net::CookieMonster::CanonicalCookie cookie(GURL(), "", "", tests[i].domain, | 207 net::CookieMonster::CanonicalCookie cookie(GURL(), "", "", tests[i].domain, |
| 209 "", "", "", base::Time(), | 208 "", "", "", base::Time(), |
| 210 base::Time(), base::Time(), | 209 base::Time(), base::Time(), |
| 211 false, false, false); | 210 false, false, false); |
| 212 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); | 211 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); |
| 213 } | 212 } |
| 214 } | 213 } |
| OLD | NEW |