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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // To save typing ValueStore::DEFAULTS everywhere. | 29 // To save typing ValueStore::DEFAULTS everywhere. |
30 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; | 30 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; |
31 | 31 |
32 // Creates a kilobyte of data. | 32 // Creates a kilobyte of data. |
33 scoped_ptr<Value> CreateKilobyte() { | 33 scoped_ptr<Value> CreateKilobyte() { |
34 std::string kilobyte_string; | 34 std::string kilobyte_string; |
35 for (int i = 0; i < 1024; ++i) { | 35 for (int i = 0; i < 1024; ++i) { |
36 kilobyte_string += "a"; | 36 kilobyte_string += "a"; |
37 } | 37 } |
38 return scoped_ptr<Value>(Value::CreateStringValue(kilobyte_string)); | 38 return scoped_ptr<Value>(new base::StringValue(kilobyte_string)); |
39 } | 39 } |
40 | 40 |
41 // Creates a megabyte of data. | 41 // Creates a megabyte of data. |
42 scoped_ptr<Value> CreateMegabyte() { | 42 scoped_ptr<Value> CreateMegabyte() { |
43 base::ListValue* megabyte = new base::ListValue(); | 43 base::ListValue* megabyte = new base::ListValue(); |
44 for (int i = 0; i < 1000; ++i) { | 44 for (int i = 0; i < 1000; ++i) { |
45 megabyte->Append(CreateKilobyte().release()); | 45 megabyte->Append(CreateKilobyte().release()); |
46 } | 46 } |
47 return scoped_ptr<Value>(megabyte); | 47 return scoped_ptr<Value>(megabyte); |
48 } | 48 } |
49 | 49 |
50 } | 50 } // namespace |
51 | 51 |
52 class ExtensionSettingsFrontendTest : public testing::Test { | 52 class ExtensionSettingsFrontendTest : public testing::Test { |
53 public: | 53 public: |
54 ExtensionSettingsFrontendTest() | 54 ExtensionSettingsFrontendTest() |
55 : storage_factory_(new util::ScopedSettingsStorageFactory()), | 55 : storage_factory_(new util::ScopedSettingsStorageFactory()), |
56 ui_thread_(BrowserThread::UI, base::MessageLoop::current()), | 56 ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
57 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} | 57 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} |
58 | 58 |
59 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() OVERRIDE { |
60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 frontend_->RunWithStorage( | 280 frontend_->RunWithStorage( |
281 id, settings::SYNC, base::Bind(&UnlimitedSyncStorageTestCallback)); | 281 id, settings::SYNC, base::Bind(&UnlimitedSyncStorageTestCallback)); |
282 frontend_->RunWithStorage( | 282 frontend_->RunWithStorage( |
283 id, settings::LOCAL, base::Bind(&UnlimitedLocalStorageTestCallback)); | 283 id, settings::LOCAL, base::Bind(&UnlimitedLocalStorageTestCallback)); |
284 | 284 |
285 base::MessageLoop::current()->RunUntilIdle(); | 285 base::MessageLoop::current()->RunUntilIdle(); |
286 } | 286 } |
287 | 287 |
288 } // namespace extensions | 288 } // namespace extensions |
OLD | NEW |