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 22 matching lines...) Expand all Loading... |
33 const bool matches; | 33 const bool matches; |
34 }; | 34 }; |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 class ExtensionCookiesTest : public testing::Test { | 38 class ExtensionCookiesTest : public testing::Test { |
39 }; | 39 }; |
40 | 40 |
41 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { | 41 TEST_F(ExtensionCookiesTest, StoreIdProfileConversion) { |
42 TestingProfile::Builder profile_builder; | 42 TestingProfile::Builder profile_builder; |
43 TestingProfile::Builder otr_profile_builder; | |
44 otr_profile_builder.SetIncognito(); | |
45 scoped_ptr<TestingProfile> profile = profile_builder.Build(); | 43 scoped_ptr<TestingProfile> profile = profile_builder.Build(); |
46 scoped_ptr<TestingProfile> otr_profile = otr_profile_builder.Build(); | 44 // Trigger early creation of off-the-record profile. |
47 otr_profile->SetOriginalProfile(profile.get()); | 45 EXPECT_TRUE(profile->GetOffTheRecordProfile()); |
48 profile->SetOffTheRecordProfile(otr_profile.PassAs<Profile>()); | |
49 | 46 |
50 EXPECT_EQ(std::string("0"), | 47 EXPECT_EQ(std::string("0"), |
51 cookies_helpers::GetStoreIdFromProfile(profile.get())); | 48 cookies_helpers::GetStoreIdFromProfile(profile.get())); |
52 EXPECT_EQ(profile.get(), | 49 EXPECT_EQ(profile.get(), |
53 cookies_helpers::ChooseProfileFromStoreId( | 50 cookies_helpers::ChooseProfileFromStoreId( |
54 "0", profile.get(), true)); | 51 "0", profile.get(), true)); |
55 EXPECT_EQ(profile.get(), | 52 EXPECT_EQ(profile.get(), |
56 cookies_helpers::ChooseProfileFromStoreId( | 53 cookies_helpers::ChooseProfileFromStoreId( |
57 "0", profile.get(), false)); | 54 "0", profile.get(), false)); |
58 EXPECT_EQ(profile->GetOffTheRecordProfile(), | 55 EXPECT_EQ(profile->GetOffTheRecordProfile(), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 false, | 190 false, |
194 net::COOKIE_PRIORITY_DEFAULT); | 191 net::COOKIE_PRIORITY_DEFAULT); |
195 scoped_ptr<Cookie> cookie( | 192 scoped_ptr<Cookie> cookie( |
196 cookies_helpers::CreateCookie( | 193 cookies_helpers::CreateCookie( |
197 canonical_cookie, "some cookie store")); | 194 canonical_cookie, "some cookie store")); |
198 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); | 195 EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); |
199 EXPECT_EQ(std::string(), cookie->path); | 196 EXPECT_EQ(std::string(), cookie->path); |
200 } | 197 } |
201 | 198 |
202 } // namespace extensions | 199 } // namespace extensions |
OLD | NEW |