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" |
11 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h" | 11 #include "chrome/browser/extensions/api/cookies/cookies_api_constants.h" |
12 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" | 12 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" |
13 #include "chrome/common/extensions/api/cookies.h" | 13 #include "chrome/common/extensions/api/cookies.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "net/cookies/canonical_cookie.h" | 16 #include "net/cookies/canonical_cookie.h" |
16 #include "net/cookies/cookie_constants.h" | 17 #include "net/cookies/cookie_constants.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 using extensions::api::cookies::Cookie; | 20 using extensions::api::cookies::Cookie; |
20 using extensions::api::cookies::CookieStore; | 21 using extensions::api::cookies::CookieStore; |
21 | 22 |
22 namespace GetAll = extensions::api::cookies::GetAll; | 23 namespace GetAll = extensions::api::cookies::GetAll; |
23 | 24 |
24 namespace extensions { | 25 namespace extensions { |
25 | 26 |
26 namespace keys = cookies_api_constants; | 27 namespace keys = cookies_api_constants; |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 struct DomainMatchCase { | 31 struct DomainMatchCase { |
31 const char* filter; | 32 const char* filter; |
32 const char* domain; | 33 const char* domain; |
33 const bool matches; | 34 const bool matches; |
34 }; | 35 }; |
35 | 36 |
36 } // namespace | 37 } // namespace |
37 | 38 |
38 class ExtensionCookiesTest : public testing::Test { | 39 class ExtensionCookiesTest : public testing::Test { |
| 40 private: |
| 41 content::TestBrowserThreadBundle thread_bundle_; |
39 }; | 42 }; |
40 | 43 |
41 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { | 44 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { |
42 TestingProfile::Builder profile_builder; | 45 TestingProfile::Builder profile_builder; |
43 scoped_ptr<TestingProfile> profile = profile_builder.Build(); | 46 scoped_ptr<TestingProfile> profile = profile_builder.Build(); |
44 // Trigger early creation of off-the-record profile. | 47 // Trigger early creation of off-the-record profile. |
45 EXPECT_TRUE(profile->GetOffTheRecordProfile()); | 48 EXPECT_TRUE(profile->GetOffTheRecordProfile()); |
46 | 49 |
47 EXPECT_EQ(std::string("0"), | 50 EXPECT_EQ(std::string("0"), |
48 cookies_helpers::GetStoreIdFromProfile(profile.get())); | 51 cookies_helpers::GetStoreIdFromProfile(profile.get())); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 false, | 193 false, |
191 net::COOKIE_PRIORITY_DEFAULT); | 194 net::COOKIE_PRIORITY_DEFAULT); |
192 scoped_ptr<Cookie> cookie( | 195 scoped_ptr<Cookie> cookie( |
193 cookies_helpers::CreateCookie( | 196 cookies_helpers::CreateCookie( |
194 canonical_cookie, "some cookie store")); | 197 canonical_cookie, "some cookie store")); |
195 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); | 198 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); |
196 EXPECT_EQ(std::string(), cookie->path); | 199 EXPECT_EQ(std::string(), cookie->path); |
197 } | 200 } |
198 | 201 |
199 } // namespace extensions | 202 } // namespace extensions |
OLD | NEW |