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

Side by Side Diff: chrome/browser/sync/test/integration/sync_extension_helper.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 "chrome/browser/sync/test/integration/sync_extension_helper.h" 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SetupProfile(test->GetProfile(i)); 54 SetupProfile(test->GetProfile(i));
55 } 55 }
56 SetupProfile(test->verifier()); 56 SetupProfile(test->verifier());
57 57
58 setup_completed_ = true; 58 setup_completed_ = true;
59 } 59 }
60 60
61 std::string SyncExtensionHelper::InstallExtension( 61 std::string SyncExtensionHelper::InstallExtension(
62 Profile* profile, const std::string& name, Manifest::Type type) { 62 Profile* profile, const std::string& name, Manifest::Type type) {
63 scoped_refptr<Extension> extension = GetExtension(profile, name, type); 63 scoped_refptr<Extension> extension = GetExtension(profile, name, type);
64 if (!extension) { 64 if (!extension.get()) {
65 NOTREACHED() << "Could not install extension " << name; 65 NOTREACHED() << "Could not install extension " << name;
66 return std::string(); 66 return std::string();
67 } 67 }
68 profile->GetExtensionService()->OnExtensionInstalled( 68 profile->GetExtensionService()
69 extension, syncer::StringOrdinal(), false /* no requirement errors */, 69 ->OnExtensionInstalled(extension.get(),
70 false /* don't wait for idle to install */); 70 syncer::StringOrdinal(),
71 false /* no requirement errors */,
72 false /* don't wait for idle to install */);
71 return extension->id(); 73 return extension->id();
72 } 74 }
73 75
74 void SyncExtensionHelper::UninstallExtension( 76 void SyncExtensionHelper::UninstallExtension(
75 Profile* profile, const std::string& name) { 77 Profile* profile, const std::string& name) {
76 ExtensionService::UninstallExtensionHelper( 78 ExtensionService::UninstallExtensionHelper(
77 profile->GetExtensionService(), 79 profile->GetExtensionService(),
78 extensions::id_util::GenerateId(name)); 80 extensions::id_util::GenerateId(name));
79 } 81 }
80 82
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return NULL; 316 return NULL;
315 } 317 }
316 std::string error; 318 std::string error;
317 scoped_refptr<Extension> extension = 319 scoped_refptr<Extension> extension =
318 Extension::Create(extension_dir, Manifest::INTERNAL, source, 320 Extension::Create(extension_dir, Manifest::INTERNAL, source,
319 Extension::NO_FLAGS, &error); 321 Extension::NO_FLAGS, &error);
320 if (!error.empty()) { 322 if (!error.empty()) {
321 ADD_FAILURE() << error; 323 ADD_FAILURE() << error;
322 return NULL; 324 return NULL;
323 } 325 }
324 if (!extension) { 326 if (!extension.get()) {
325 ADD_FAILURE(); 327 ADD_FAILURE();
326 return NULL; 328 return NULL;
327 } 329 }
328 if (extension->name() != name) { 330 if (extension->name() != name) {
329 EXPECT_EQ(name, extension->name()); 331 EXPECT_EQ(name, extension->name());
330 return NULL; 332 return NULL;
331 } 333 }
332 if (extension->GetType() != type) { 334 if (extension->GetType() != type) {
333 EXPECT_EQ(type, extension->GetType()); 335 EXPECT_EQ(type, extension->GetType());
334 return NULL; 336 return NULL;
(...skipping 15 matching lines...) Expand all
350 return NULL; 352 return NULL;
351 } 353 }
352 ExtensionNameMap::const_iterator it2 = it->second.find(name); 354 ExtensionNameMap::const_iterator it2 = it->second.find(name);
353 if (it2 != it->second.end()) { 355 if (it2 != it->second.end()) {
354 return it2->second; 356 return it2->second;
355 } 357 }
356 358
357 scoped_refptr<Extension> extension = 359 scoped_refptr<Extension> extension =
358 CreateExtension(profile->GetExtensionService()->install_directory(), 360 CreateExtension(profile->GetExtensionService()->install_directory(),
359 name, type); 361 name, type);
360 if (!extension) { 362 if (!extension.get()) {
361 ADD_FAILURE(); 363 ADD_FAILURE();
362 return NULL; 364 return NULL;
363 } 365 }
364 const std::string& expected_id = extensions::id_util::GenerateId(name); 366 const std::string& expected_id = extensions::id_util::GenerateId(name);
365 if (extension->id() != expected_id) { 367 if (extension->id() != expected_id) {
366 EXPECT_EQ(expected_id, extension->id()); 368 EXPECT_EQ(expected_id, extension->id());
367 return NULL; 369 return NULL;
368 } 370 }
369 DVLOG(2) << "created extension with name = " 371 DVLOG(2) << "created extension with name = "
370 << name << ", id = " << expected_id; 372 << name << ", id = " << expected_id;
371 (it->second)[name] = extension; 373 (it->second)[name] = extension;
372 id_to_name_[expected_id] = name; 374 id_to_name_[expected_id] = name;
373 id_to_type_[expected_id] = type; 375 id_to_type_[expected_id] = type;
374 return extension; 376 return extension;
375 } 377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698