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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 class TestCompletionCallback { | 15 class TestCompletionCallback { |
15 public: | 16 public: |
16 TestCompletionCallback() | 17 TestCompletionCallback() |
17 : have_result_(false) { | 18 : have_result_(false) { |
18 } | 19 } |
19 | 20 |
20 bool have_result() const { return have_result_; } | 21 bool have_result() const { return have_result_; } |
21 | 22 |
22 void callback() { | 23 void callback() { |
23 have_result_ = true; | 24 have_result_ = true; |
24 } | 25 } |
25 | 26 |
26 private: | 27 private: |
27 bool have_result_; | 28 bool have_result_; |
28 }; | 29 }; |
29 | 30 |
30 } // namespace | 31 } // namespace |
31 | 32 |
32 typedef testing::Test CannedBrowsingDataAppCacheHelperTest; | 33 class CannedBrowsingDataAppCacheHelperTest : public testing::Test { |
| 34 private: |
| 35 content::TestBrowserThreadBundle thread_bundle_; |
| 36 }; |
33 | 37 |
34 TEST_F(CannedBrowsingDataAppCacheHelperTest, SetInfo) { | 38 TEST_F(CannedBrowsingDataAppCacheHelperTest, SetInfo) { |
35 TestingProfile profile; | 39 TestingProfile profile; |
36 | 40 |
37 GURL manifest1("http://example1.com/manifest.xml"); | 41 GURL manifest1("http://example1.com/manifest.xml"); |
38 GURL manifest2("http://example2.com/path1/manifest.xml"); | 42 GURL manifest2("http://example2.com/path1/manifest.xml"); |
39 GURL manifest3("http://example2.com/path2/manifest.xml"); | 43 GURL manifest3("http://example2.com/path2/manifest.xml"); |
40 | 44 |
41 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 45 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
42 new CannedBrowsingDataAppCacheHelper(&profile)); | 46 new CannedBrowsingDataAppCacheHelper(&profile)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 117 |
114 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 118 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
115 new CannedBrowsingDataAppCacheHelper(&profile)); | 119 new CannedBrowsingDataAppCacheHelper(&profile)); |
116 | 120 |
117 ASSERT_TRUE(helper->empty()); | 121 ASSERT_TRUE(helper->empty()); |
118 helper->AddAppCache(manifest1); | 122 helper->AddAppCache(manifest1); |
119 ASSERT_TRUE(helper->empty()); | 123 ASSERT_TRUE(helper->empty()); |
120 helper->AddAppCache(manifest2); | 124 helper->AddAppCache(manifest2); |
121 ASSERT_TRUE(helper->empty()); | 125 ASSERT_TRUE(helper->empty()); |
122 } | 126 } |
OLD | NEW |