| 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 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "build/build_config.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 class TestCompletionCallback { | 20 class TestCompletionCallback { |
| 20 public: | 21 public: |
| 21 TestCompletionCallback() {} | 22 TestCompletionCallback() {} |
| 22 | 23 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 117 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
| 117 new CannedBrowsingDataAppCacheHelper(&profile_)); | 118 new CannedBrowsingDataAppCacheHelper(&profile_)); |
| 118 | 119 |
| 119 ASSERT_TRUE(helper->empty()); | 120 ASSERT_TRUE(helper->empty()); |
| 120 helper->AddAppCache(manifest); | 121 helper->AddAppCache(manifest); |
| 121 ASSERT_FALSE(helper->empty()); | 122 ASSERT_FALSE(helper->empty()); |
| 122 helper->Reset(); | 123 helper->Reset(); |
| 123 ASSERT_TRUE(helper->empty()); | 124 ASSERT_TRUE(helper->empty()); |
| 124 } | 125 } |
| 125 | 126 |
| 126 TEST_F(CannedBrowsingDataAppCacheHelperTest, Delete) { | 127 // Flaky on linux. See crbug.com/740801. |
| 128 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 129 #define MAYBE_Delete DISABLED_Delete |
| 130 #else |
| 131 #define MAYBE_Delete Delete |
| 132 #endif |
| 133 |
| 134 TEST_F(CannedBrowsingDataAppCacheHelperTest, MAYBE_Delete) { |
| 127 GURL manifest1("http://example.com/manifest1.xml"); | 135 GURL manifest1("http://example.com/manifest1.xml"); |
| 128 GURL manifest2("http://foo.example.com/manifest2.xml"); | 136 GURL manifest2("http://foo.example.com/manifest2.xml"); |
| 129 GURL manifest3("http://bar.example.com/manifest3.xml"); | 137 GURL manifest3("http://bar.example.com/manifest3.xml"); |
| 130 | 138 |
| 131 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 139 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
| 132 new CannedBrowsingDataAppCacheHelper(&profile_)); | 140 new CannedBrowsingDataAppCacheHelper(&profile_)); |
| 133 | 141 |
| 134 EXPECT_TRUE(helper->empty()); | 142 EXPECT_TRUE(helper->empty()); |
| 135 helper->AddAppCache(manifest1); | 143 helper->AddAppCache(manifest1); |
| 136 helper->AddAppCache(manifest2); | 144 helper->AddAppCache(manifest2); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 149 | 157 |
| 150 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 158 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
| 151 new CannedBrowsingDataAppCacheHelper(&profile_)); | 159 new CannedBrowsingDataAppCacheHelper(&profile_)); |
| 152 | 160 |
| 153 ASSERT_TRUE(helper->empty()); | 161 ASSERT_TRUE(helper->empty()); |
| 154 helper->AddAppCache(manifest1); | 162 helper->AddAppCache(manifest1); |
| 155 ASSERT_TRUE(helper->empty()); | 163 ASSERT_TRUE(helper->empty()); |
| 156 helper->AddAppCache(manifest2); | 164 helper->AddAppCache(manifest2); |
| 157 ASSERT_TRUE(helper->empty()); | 165 ASSERT_TRUE(helper->empty()); |
| 158 } | 166 } |
| OLD | NEW |