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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add ::From Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 this, 357 this,
358 new extensions::ExternalTestingLoader(json_data, fake_base_path_), 358 new extensions::ExternalTestingLoader(json_data, fake_base_path_),
359 profile_.get(), 359 profile_.get(),
360 Manifest::EXTERNAL_PREF, 360 Manifest::EXTERNAL_PREF,
361 Manifest::EXTERNAL_PREF_DOWNLOAD, 361 Manifest::EXTERNAL_PREF_DOWNLOAD,
362 Extension::NO_FLAGS)); 362 Extension::NO_FLAGS));
363 363
364 // We also parse the file into a dictionary to compare what we get back 364 // We also parse the file into a dictionary to compare what we get back
365 // from the provider. 365 // from the provider.
366 JSONStringValueDeserializer deserializer(json_data); 366 JSONStringValueDeserializer deserializer(json_data);
367 base::Value* json_value = deserializer.Deserialize(NULL, NULL); 367 scoped_ptr<base::Value> json_value = deserializer.Deserialize(NULL, NULL);
368 368
369 if (!json_value || !json_value->IsType(base::Value::TYPE_DICTIONARY)) { 369 if (!json_value || !json_value->IsType(base::Value::TYPE_DICTIONARY)) {
370 NOTREACHED() << "Unable to deserialize json data"; 370 NOTREACHED() << "Unable to deserialize json data";
371 return -1; 371 return -1;
372 } else { 372 } else {
373 base::DictionaryValue* external_extensions = 373 prefs_ = base::DictionaryValue::From(json_value.Pass());
374 static_cast<base::DictionaryValue*>(json_value);
375 prefs_.reset(external_extensions);
376 } 374 }
377 375
378 // Reset our counter. 376 // Reset our counter.
379 ids_found_ = 0; 377 ids_found_ = 0;
380 // Ask the provider to look up all extensions and return them. 378 // Ask the provider to look up all extensions and return them.
381 provider_->VisitRegisteredExtension(); 379 provider_->VisitRegisteredExtension();
382 380
383 return ids_found_; 381 return ids_found_;
384 } 382 }
385 383
(...skipping 7838 matching lines...) Expand 10 before | Expand all | Expand 10 after
8224 8222
8225 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 8223 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
8226 content::Source<Profile>(profile()), 8224 content::Source<Profile>(profile()),
8227 content::NotificationService::NoDetails()); 8225 content::NotificationService::NoDetails());
8228 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 8226 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
8229 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 8227 EXPECT_EQ(0u, registry()->enabled_extensions().size());
8230 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 8228 EXPECT_EQ(0u, registry()->disabled_extensions().size());
8231 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 8229 EXPECT_EQ(0u, registry()->terminated_extensions().size());
8232 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 8230 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
8233 } 8231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698