OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 19 matching lines...) Expand all Loading... |
30 const char* filter; | 30 const char* filter; |
31 const char* domain; | 31 const char* domain; |
32 const bool matches; | 32 const bool matches; |
33 }; | 33 }; |
34 | 34 |
35 // A test profile that supports linking with another profile for incognito | 35 // A test profile that supports linking with another profile for incognito |
36 // support. | 36 // support. |
37 class OtrTestingProfile : public TestingProfile { | 37 class OtrTestingProfile : public TestingProfile { |
38 public: | 38 public: |
39 OtrTestingProfile() : linked_profile_(NULL) {} | 39 OtrTestingProfile() : linked_profile_(NULL) {} |
40 virtual Profile* GetOriginalProfile() { | 40 virtual Profile* GetOriginalProfile() OVERRIDE { |
41 if (IsOffTheRecord()) | 41 if (IsOffTheRecord()) |
42 return linked_profile_; | 42 return linked_profile_; |
43 else | 43 else |
44 return this; | 44 return this; |
45 } | 45 } |
46 | 46 |
47 virtual Profile* GetOffTheRecordProfile() { | 47 virtual Profile* GetOffTheRecordProfile() OVERRIDE { |
48 if (IsOffTheRecord()) | 48 if (IsOffTheRecord()) |
49 return this; | 49 return this; |
50 else | 50 else |
51 return linked_profile_; | 51 return linked_profile_; |
52 } | 52 } |
53 | 53 |
54 virtual bool HasOffTheRecordProfile() { | 54 virtual bool HasOffTheRecordProfile() OVERRIDE { |
55 return (!IsOffTheRecord() && linked_profile_); | 55 return (!IsOffTheRecord() && linked_profile_); |
56 } | 56 } |
57 | 57 |
58 static void LinkProfiles(OtrTestingProfile* profile1, | 58 static void LinkProfiles(OtrTestingProfile* profile1, |
59 OtrTestingProfile* profile2) { | 59 OtrTestingProfile* profile2) { |
60 profile1->set_linked_profile(profile2); | 60 profile1->set_linked_profile(profile2); |
61 profile2->set_linked_profile(profile1); | 61 profile2->set_linked_profile(profile1); |
62 } | 62 } |
63 | 63 |
64 void set_linked_profile(OtrTestingProfile* profile) { | 64 void set_linked_profile(OtrTestingProfile* profile) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 GURL(), "", "011Q255bNX_1!yd\203e+", "test.com", "/path\203", "", "", | 214 GURL(), "", "011Q255bNX_1!yd\203e+", "test.com", "/path\203", "", "", |
215 base::Time(), base::Time(), base::Time(), false, false); | 215 base::Time(), base::Time(), base::Time(), false, false); |
216 scoped_ptr<Cookie> cookie( | 216 scoped_ptr<Cookie> cookie( |
217 cookies_helpers::CreateCookie( | 217 cookies_helpers::CreateCookie( |
218 canonical_cookie, "some cookie store")); | 218 canonical_cookie, "some cookie store")); |
219 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); | 219 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); |
220 EXPECT_EQ(std::string(""), cookie->path); | 220 EXPECT_EQ(std::string(""), cookie->path); |
221 } | 221 } |
222 | 222 |
223 } // namespace extensions | 223 } // namespace extensions |
OLD | NEW |