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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 private: | 86 private: |
87 base::MessageLoop message_loop_; | 87 base::MessageLoop message_loop_; |
88 content::TestBrowserThread ui_thread_; | 88 content::TestBrowserThread ui_thread_; |
89 content::TestBrowserThread file_thread_; | 89 content::TestBrowserThread file_thread_; |
90 }; | 90 }; |
91 | 91 |
92 // Get a semblance of coverage for both extension and app settings by | 92 // Get a semblance of coverage for both extension and app settings by |
93 // alternating in each test. | 93 // alternating in each test. |
94 // TODO(kalman): explicitly test the two interact correctly. | 94 // TODO(kalman): explicitly test the two interact correctly. |
95 | 95 |
| 96 // Tests that the frontend is set up correctly. |
| 97 TEST_F(ExtensionSettingsFrontendTest, Basics) { |
| 98 // Local storage is always enabled. |
| 99 EXPECT_TRUE(frontend_->IsStorageEnabled(settings::LOCAL)); |
| 100 EXPECT_TRUE(frontend_->GetValueStoreCache(settings::LOCAL)); |
| 101 |
| 102 // Invalid storage areas are not available. |
| 103 EXPECT_FALSE(frontend_->IsStorageEnabled(settings::INVALID)); |
| 104 EXPECT_FALSE(frontend_->GetValueStoreCache(settings::INVALID)); |
| 105 } |
| 106 |
96 TEST_F(ExtensionSettingsFrontendTest, SettingsPreservedAcrossReconstruction) { | 107 TEST_F(ExtensionSettingsFrontendTest, SettingsPreservedAcrossReconstruction) { |
97 const std::string id = "ext"; | 108 const std::string id = "ext"; |
98 scoped_refptr<const Extension> extension = | 109 scoped_refptr<const Extension> extension = |
99 util::AddExtensionWithId(profile(), id, Manifest::TYPE_EXTENSION); | 110 util::AddExtensionWithId(profile(), id, Manifest::TYPE_EXTENSION); |
100 | 111 |
101 ValueStore* storage = util::GetStorage(extension, frontend_.get()); | 112 ValueStore* storage = util::GetStorage(extension, frontend_.get()); |
102 | 113 |
103 // The correctness of Get/Set/Remove/Clear is tested elsewhere so no need to | 114 // The correctness of Get/Set/Remove/Clear is tested elsewhere so no need to |
104 // be too rigorous. | 115 // be too rigorous. |
105 { | 116 { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 frontend_->RunWithStorage( | 284 frontend_->RunWithStorage( |
274 extension, settings::SYNC, base::Bind(&UnlimitedSyncStorageTestCallback)); | 285 extension, settings::SYNC, base::Bind(&UnlimitedSyncStorageTestCallback)); |
275 frontend_->RunWithStorage(extension, | 286 frontend_->RunWithStorage(extension, |
276 settings::LOCAL, | 287 settings::LOCAL, |
277 base::Bind(&UnlimitedLocalStorageTestCallback)); | 288 base::Bind(&UnlimitedLocalStorageTestCallback)); |
278 | 289 |
279 base::MessageLoop::current()->RunUntilIdle(); | 290 base::MessageLoop::current()->RunUntilIdle(); |
280 } | 291 } |
281 | 292 |
282 } // namespace extensions | 293 } // namespace extensions |
OLD | NEW |