| OLD | NEW |
| 1 // Copyright (c) 2010 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 "chrome/browser/browsing_data_appcache_helper.h" | 5 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/test/base/testing_browser_process_test.h" | |
| 9 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 10 |
| 12 namespace { | 11 namespace { |
| 13 class TestCompletionCallback { | 12 class TestCompletionCallback { |
| 14 public: | 13 public: |
| 15 TestCompletionCallback() | 14 TestCompletionCallback() |
| 16 : have_result_(false) { | 15 : have_result_(false) { |
| 17 } | 16 } |
| 18 | 17 |
| 19 bool have_result() const { return have_result_; } | 18 bool have_result() const { return have_result_; } |
| 20 | 19 |
| 21 void callback() { | 20 void callback() { |
| 22 have_result_ = true; | 21 have_result_ = true; |
| 23 } | 22 } |
| 24 | 23 |
| 25 private: | 24 private: |
| 26 bool have_result_; | 25 bool have_result_; |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 } // namespace | 28 } // namespace |
| 30 | 29 |
| 31 typedef TestingBrowserProcessTest CannedBrowsingDataAppCacheHelperTest; | 30 typedef testing::Test CannedBrowsingDataAppCacheHelperTest; |
| 32 | 31 |
| 33 TEST_F(CannedBrowsingDataAppCacheHelperTest, SetInfo) { | 32 TEST_F(CannedBrowsingDataAppCacheHelperTest, SetInfo) { |
| 34 TestingProfile profile; | 33 TestingProfile profile; |
| 35 | 34 |
| 36 GURL manifest1("http://example1.com/manifest.xml"); | 35 GURL manifest1("http://example1.com/manifest.xml"); |
| 37 GURL manifest2("http://example2.com/path1/manifest.xml"); | 36 GURL manifest2("http://example2.com/path1/manifest.xml"); |
| 38 GURL manifest3("http://example2.com/path2/manifest.xml"); | 37 GURL manifest3("http://example2.com/path2/manifest.xml"); |
| 39 | 38 |
| 40 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 39 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
| 41 new CannedBrowsingDataAppCacheHelper(&profile)); | 40 new CannedBrowsingDataAppCacheHelper(&profile)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 95 |
| 97 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( | 96 scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( |
| 98 new CannedBrowsingDataAppCacheHelper(&profile)); | 97 new CannedBrowsingDataAppCacheHelper(&profile)); |
| 99 | 98 |
| 100 ASSERT_TRUE(helper->empty()); | 99 ASSERT_TRUE(helper->empty()); |
| 101 helper->AddAppCache(manifest); | 100 helper->AddAppCache(manifest); |
| 102 ASSERT_FALSE(helper->empty()); | 101 ASSERT_FALSE(helper->empty()); |
| 103 helper->Reset(); | 102 helper->Reset(); |
| 104 ASSERT_TRUE(helper->empty()); | 103 ASSERT_TRUE(helper->empty()); |
| 105 } | 104 } |
| OLD | NEW |