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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 return this; | 35 return this; |
36 } | 36 } |
37 | 37 |
38 virtual Profile* GetOffTheRecordProfile() { | 38 virtual Profile* GetOffTheRecordProfile() { |
39 if (IsOffTheRecord()) | 39 if (IsOffTheRecord()) |
40 return this; | 40 return this; |
41 else | 41 else |
42 return linked_profile_; | 42 return linked_profile_; |
43 } | 43 } |
44 | 44 |
| 45 virtual bool HasOffTheRecordProfile() { |
| 46 return (!IsOffTheRecord() && linked_profile_); |
| 47 } |
| 48 |
45 static void LinkProfiles(OtrTestingProfile* profile1, | 49 static void LinkProfiles(OtrTestingProfile* profile1, |
46 OtrTestingProfile* profile2) { | 50 OtrTestingProfile* profile2) { |
47 profile1->set_linked_profile(profile2); | 51 profile1->set_linked_profile(profile2); |
48 profile2->set_linked_profile(profile1); | 52 profile2->set_linked_profile(profile1); |
49 } | 53 } |
50 | 54 |
51 void set_linked_profile(OtrTestingProfile* profile) { | 55 void set_linked_profile(OtrTestingProfile* profile) { |
52 linked_profile_ = profile; | 56 linked_profile_ = profile; |
53 } | 57 } |
54 | 58 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); | 198 details->SetString(keys::kDomainKey, std::string(tests[i].filter)); |
195 extension_cookies_helpers::MatchFilter filter(details.get()); | 199 extension_cookies_helpers::MatchFilter filter(details.get()); |
196 net::CookieMonster::CanonicalCookie cookie("", "", tests[i].domain, | 200 net::CookieMonster::CanonicalCookie cookie("", "", tests[i].domain, |
197 "", false, false, | 201 "", false, false, |
198 base::Time(), | 202 base::Time(), |
199 base::Time(), | 203 base::Time(), |
200 false, base::Time()); | 204 false, base::Time()); |
201 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); | 205 EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); |
202 } | 206 } |
203 } | 207 } |
OLD | NEW |