OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/testing_profile.h" | 13 #include "chrome/test/testing_profile.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 namespace keys = extension_cookies_api_constants; | 16 namespace keys = extension_cookies_api_constants; |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 struct DomainMatchCase { | 20 struct DomainMatchCase { |
21 const char* filter; | 21 const char* filter; |
22 const char* domain; | 22 const char* domain; |
23 const bool matches; | 23 const bool matches; |
24 }; | 24 }; |
25 | 25 |
26 // A test profile that supports linking with another profile for off-the-record | 26 // A test profile that supports linking with another profile for incognito |
27 // (a.k.a. incognito) support. | 27 // (a.k.a. incognito) support. |
akalin
2011/03/08 03:07:47
remove (a.k.a. incognito)
| |
28 class OtrTestingProfile : public TestingProfile { | 28 class OtrTestingProfile : public TestingProfile { |
29 public: | 29 public: |
30 OtrTestingProfile() : linked_profile_(NULL) {} | 30 OtrTestingProfile() : linked_profile_(NULL) {} |
31 virtual Profile* GetOriginalProfile() { | 31 virtual Profile* GetOriginalProfile() { |
32 if (IsOffTheRecord()) | 32 if (IsOffTheRecord()) |
33 return linked_profile_; | 33 return linked_profile_; |
34 else | 34 else |
35 return this; | 35 return this; |
36 } | 36 } |
37 | 37 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); | 199 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); |
200 extension_cookies_helpers::MatchFilter filter(details.get()); | 200 extension_cookies_helpers::MatchFilter filter(details.get()); |
201 net::CookieMonster::CanonicalCookie cookie(GURL(), "", "", tests[i].domain, | 201 net::CookieMonster::CanonicalCookie cookie(GURL(), "", "", tests[i].domain, |
202 "", false, false, | 202 "", false, false, |
203 base::Time(), | 203 base::Time(), |
204 base::Time(), | 204 base::Time(), |
205 false, base::Time()); | 205 false, base::Time()); |
206 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); | 206 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); |
207 } | 207 } |
208 } | 208 } |
OLD | NEW |