OLD | NEW |
1 // Copyright (c) 2009 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 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "webkit/appcache/appcache.h" | 7 #include "webkit/appcache/appcache.h" |
8 #include "webkit/appcache/appcache_group.h" | 8 #include "webkit/appcache/appcache_group.h" |
9 #include "webkit/appcache/appcache_response.h" | 9 #include "webkit/appcache/appcache_response.h" |
10 #include "webkit/appcache/appcache_storage.h" | 10 #include "webkit/appcache/appcache_storage.h" |
11 #include "webkit/appcache/mock_appcache_service.h" | 11 #include "webkit/appcache/mock_appcache_service.h" |
(...skipping 18 matching lines...) Expand all Loading... |
30 | 30 |
31 EXPECT_TRUE(!service.storage()->working_set()->GetCache(111)); | 31 EXPECT_TRUE(!service.storage()->working_set()->GetCache(111)); |
32 | 32 |
33 // Removing non-existing cache from service should not fail. | 33 // Removing non-existing cache from service should not fail. |
34 MockAppCacheService dummy; | 34 MockAppCacheService dummy; |
35 dummy.storage()->working_set()->RemoveCache(cache); | 35 dummy.storage()->working_set()->RemoveCache(cache); |
36 } | 36 } |
37 | 37 |
38 TEST_F(AppCacheStorageTest, AddRemoveGroup) { | 38 TEST_F(AppCacheStorageTest, AddRemoveGroup) { |
39 MockAppCacheService service; | 39 MockAppCacheService service; |
40 scoped_refptr<AppCacheGroup> group = | 40 scoped_refptr<AppCacheGroup> group = new AppCacheGroup(&service, GURL(), 111); |
41 new AppCacheGroup(&service, GURL::EmptyGURL(), 111); | |
42 | 41 |
43 EXPECT_EQ(group.get(), | 42 EXPECT_EQ(group.get(), service.storage()->working_set()->GetGroup(GURL())); |
44 service.storage()->working_set()->GetGroup(GURL::EmptyGURL())); | |
45 | 43 |
46 service.storage()->working_set()->RemoveGroup(group); | 44 service.storage()->working_set()->RemoveGroup(group); |
47 | 45 |
48 EXPECT_TRUE(!service.storage()->working_set()->GetGroup(GURL::EmptyGURL())); | 46 EXPECT_TRUE(!service.storage()->working_set()->GetGroup(GURL())); |
49 | 47 |
50 // Removing non-existing group from service should not fail. | 48 // Removing non-existing group from service should not fail. |
51 MockAppCacheService dummy; | 49 MockAppCacheService dummy; |
52 dummy.storage()->working_set()->RemoveGroup(group); | 50 dummy.storage()->working_set()->RemoveGroup(group); |
53 } | 51 } |
54 | 52 |
55 TEST_F(AppCacheStorageTest, AddRemoveResponseInfo) { | 53 TEST_F(AppCacheStorageTest, AddRemoveResponseInfo) { |
56 MockAppCacheService service; | 54 MockAppCacheService service; |
57 scoped_refptr<AppCacheResponseInfo> info = | 55 scoped_refptr<AppCacheResponseInfo> info = |
58 new AppCacheResponseInfo(&service, GURL(), | 56 new AppCacheResponseInfo(&service, GURL(), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 100 |
103 delegate_reference2 = | 101 delegate_reference2 = |
104 service.storage()->GetOrCreateDelegateReference(&delegate); | 102 service.storage()->GetOrCreateDelegateReference(&delegate); |
105 EXPECT_TRUE(delegate_reference2.get()); | 103 EXPECT_TRUE(delegate_reference2.get()); |
106 EXPECT_TRUE(delegate_reference2->HasOneRef()); | 104 EXPECT_TRUE(delegate_reference2->HasOneRef()); |
107 EXPECT_EQ(&delegate, delegate_reference2->delegate); | 105 EXPECT_EQ(&delegate, delegate_reference2->delegate); |
108 EXPECT_NE(delegate_reference1.get(), delegate_reference2.get()); | 106 EXPECT_NE(delegate_reference1.get(), delegate_reference2.get()); |
109 } | 107 } |
110 | 108 |
111 } // namespace appcache | 109 } // namespace appcache |
OLD | NEW |