Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/extensions/api/storage/settings_frontend_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 9 #include "base/message_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); 158 extensions::ExtensionSystem::Get(profile_.get())->extension_service();
159 static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> 159 static_cast<extensions::settings_test_util::MockExtensionService*>(esi)->
160 AddExtensionWithId(id, Manifest::TYPE_EXTENSION); 160 AddExtensionWithId(id, Manifest::TYPE_EXTENSION);
161 161
162 ValueStore* storage = util::GetStorage(id, frontend_.get()); 162 ValueStore* storage = util::GetStorage(id, frontend_.get());
163 163
164 { 164 {
165 StringValue bar("bar"); 165 StringValue bar("bar");
166 ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar); 166 ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar);
167 ASSERT_FALSE(result->HasError()); 167 ASSERT_FALSE(result->HasError());
168 EXPECT_TRUE(file_util::PathExists(temp_dir_.path())); 168 EXPECT_TRUE(base::PathExists(temp_dir_.path()));
169 } 169 }
170 170
171 // Should need to both clear the database and delete the frontend for the 171 // Should need to both clear the database and delete the frontend for the
172 // leveldb database to be deleted from disk. 172 // leveldb database to be deleted from disk.
173 { 173 {
174 ValueStore::WriteResult result = storage->Clear(); 174 ValueStore::WriteResult result = storage->Clear();
175 ASSERT_FALSE(result->HasError()); 175 ASSERT_FALSE(result->HasError());
176 EXPECT_TRUE(file_util::PathExists(temp_dir_.path())); 176 EXPECT_TRUE(base::PathExists(temp_dir_.path()));
177 } 177 }
178 178
179 frontend_.reset(); 179 frontend_.reset();
180 base::MessageLoop::current()->RunUntilIdle(); 180 base::MessageLoop::current()->RunUntilIdle();
181 // TODO(kalman): Figure out why this fails, despite appearing to work. 181 // TODO(kalman): Figure out why this fails, despite appearing to work.
182 // Leaving this commented out rather than disabling the whole test so that the 182 // Leaving this commented out rather than disabling the whole test so that the
183 // deletion code paths are at least exercised. 183 // deletion code paths are at least exercised.
184 //EXPECT_FALSE(file_util::PathExists(temp_dir_.path())); 184 //EXPECT_FALSE(base::PathExists(temp_dir_.path()));
185 } 185 }
186 186
187 TEST_F(ExtensionSettingsFrontendTest, 187 TEST_F(ExtensionSettingsFrontendTest,
188 QuotaLimitsEnforcedCorrectlyForSyncAndLocal) { 188 QuotaLimitsEnforcedCorrectlyForSyncAndLocal) {
189 const std::string id = "ext"; 189 const std::string id = "ext";
190 ExtensionServiceInterface* esi = 190 ExtensionServiceInterface* esi =
191 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); 191 extensions::ExtensionSystem::Get(profile_.get())->extension_service();
192 static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> 192 static_cast<extensions::settings_test_util::MockExtensionService*>(esi)->
193 AddExtensionWithId(id, Manifest::TYPE_EXTENSION); 193 AddExtensionWithId(id, Manifest::TYPE_EXTENSION);
194 194
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698