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

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 todo about not failed trybot 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 this, 358 this,
359 new extensions::ExternalTestingLoader(json_data, fake_base_path_), 359 new extensions::ExternalTestingLoader(json_data, fake_base_path_),
360 profile_.get(), 360 profile_.get(),
361 Manifest::EXTERNAL_PREF, 361 Manifest::EXTERNAL_PREF,
362 Manifest::EXTERNAL_PREF_DOWNLOAD, 362 Manifest::EXTERNAL_PREF_DOWNLOAD,
363 Extension::NO_FLAGS)); 363 Extension::NO_FLAGS));
364 364
365 // We also parse the file into a dictionary to compare what we get back 365 // We also parse the file into a dictionary to compare what we get back
366 // from the provider. 366 // from the provider.
367 JSONStringValueDeserializer deserializer(json_data); 367 JSONStringValueDeserializer deserializer(json_data);
368 base::Value* json_value = deserializer.Deserialize(NULL, NULL); 368 scoped_ptr<base::Value> json_value = deserializer.Deserialize(NULL, NULL);
369 369
370 if (!json_value || !json_value->IsType(base::Value::TYPE_DICTIONARY)) { 370 if (!json_value || !json_value->IsType(base::Value::TYPE_DICTIONARY)) {
371 NOTREACHED() << "Unable to deserialize json data"; 371 NOTREACHED() << "Unable to deserialize json data";
372 return -1; 372 return -1;
373 } else { 373 } else {
374 base::DictionaryValue* external_extensions = 374 prefs_ = base::DictionaryValue::From(json_value.Pass());
375 static_cast<base::DictionaryValue*>(json_value);
376 prefs_.reset(external_extensions);
377 } 375 }
378 376
379 // Reset our counter. 377 // Reset our counter.
380 ids_found_ = 0; 378 ids_found_ = 0;
381 // Ask the provider to look up all extensions and return them. 379 // Ask the provider to look up all extensions and return them.
382 provider_->VisitRegisteredExtension(); 380 provider_->VisitRegisteredExtension();
383 381
384 return ids_found_; 382 return ids_found_;
385 } 383 }
386 384
(...skipping 7842 matching lines...) Expand 10 before | Expand all | Expand 10 after
8229 8227
8230 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 8228 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
8231 content::Source<Profile>(profile()), 8229 content::Source<Profile>(profile()),
8232 content::NotificationService::NoDetails()); 8230 content::NotificationService::NoDetails());
8233 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 8231 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
8234 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 8232 EXPECT_EQ(0u, registry()->enabled_extensions().size());
8235 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 8233 EXPECT_EQ(0u, registry()->disabled_extensions().size());
8236 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 8234 EXPECT_EQ(0u, registry()->terminated_extensions().size());
8237 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 8235 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
8238 } 8236 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_manager_unittest.cc ('k') | chrome/browser/extensions/external_pref_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698