| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/files/file_util.h" | 6 #include "base/files/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 26 matching lines...) Expand all Loading... |
| 37 // A better name for this would be StorageFrontendTest, but the historical name | 37 // A better name for this would be StorageFrontendTest, but the historical name |
| 38 // has been ExtensionSettingsFrontendTest. In order to preserve crash/failure | 38 // has been ExtensionSettingsFrontendTest. In order to preserve crash/failure |
| 39 // history, the test names are unchanged. | 39 // history, the test names are unchanged. |
| 40 class ExtensionSettingsFrontendTest : public ExtensionsTest { | 40 class ExtensionSettingsFrontendTest : public ExtensionsTest { |
| 41 public: | 41 public: |
| 42 ExtensionSettingsFrontendTest() | 42 ExtensionSettingsFrontendTest() |
| 43 : storage_factory_(new util::ScopedSettingsStorageFactory()), | 43 : storage_factory_(new util::ScopedSettingsStorageFactory()), |
| 44 ui_thread_(BrowserThread::UI, base::MessageLoop::current()), | 44 ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
| 45 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} | 45 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} |
| 46 | 46 |
| 47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() override { |
| 48 ExtensionsTest::SetUp(); | 48 ExtensionsTest::SetUp(); |
| 49 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 49 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 50 ResetFrontend(); | 50 ResetFrontend(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void TearDown() OVERRIDE { | 53 virtual void TearDown() override { |
| 54 frontend_.reset(); | 54 frontend_.reset(); |
| 55 // Execute any pending deletion tasks. | 55 // Execute any pending deletion tasks. |
| 56 message_loop_.RunUntilIdle(); | 56 message_loop_.RunUntilIdle(); |
| 57 ExtensionsTest::TearDown(); | 57 ExtensionsTest::TearDown(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 void ResetFrontend() { | 61 void ResetFrontend() { |
| 62 storage_factory_->Reset(new LeveldbSettingsStorageFactory()); | 62 storage_factory_->Reset(new LeveldbSettingsStorageFactory()); |
| 63 frontend_.reset( | 63 frontend_.reset( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Local storage should run out after ~5MB. | 211 // Local storage should run out after ~5MB. |
| 212 scoped_ptr<base::Value> megabyte = util::CreateMegabyte(); | 212 scoped_ptr<base::Value> megabyte = util::CreateMegabyte(); |
| 213 for (int i = 0; i < 5; ++i) { | 213 for (int i = 0; i < 5; ++i) { |
| 214 local_storage->Set(DEFAULTS, base::StringPrintf("%d", i), *megabyte); | 214 local_storage->Set(DEFAULTS, base::StringPrintf("%d", i), *megabyte); |
| 215 } | 215 } |
| 216 | 216 |
| 217 EXPECT_TRUE(local_storage->Set(DEFAULTS, "WillError", *megabyte)->HasError()); | 217 EXPECT_TRUE(local_storage->Set(DEFAULTS, "WillError", *megabyte)->HasError()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace extensions | 220 } // namespace extensions |
| OLD | NEW |