| 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 "chrome/browser/sync/test/integration/sync_extension_helper.h" | 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/guid.h" | 13 #include "base/guid.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/threading/thread_restrictions.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_util.h" | 21 #include "chrome/browser/extensions/extension_util.h" |
| 21 #include "chrome/browser/extensions/pending_extension_info.h" | 22 #include "chrome/browser/extensions/pending_extension_info.h" |
| 22 #include "chrome/browser/extensions/pending_extension_manager.h" | 23 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 23 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 24 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 26 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 26 #include "chrome/browser/sync/test/integration/sync_test.h" | 27 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 27 #include "components/crx_file/id_util.h" | 28 #include "components/crx_file/id_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 78 } |
| 78 if (test->use_verifier()) { | 79 if (test->use_verifier()) { |
| 79 SetupProfile(test->verifier()); | 80 SetupProfile(test->verifier()); |
| 80 } | 81 } |
| 81 | 82 |
| 82 setup_completed_ = true; | 83 setup_completed_ = true; |
| 83 } | 84 } |
| 84 | 85 |
| 85 std::string SyncExtensionHelper::InstallExtension( | 86 std::string SyncExtensionHelper::InstallExtension( |
| 86 Profile* profile, const std::string& name, Manifest::Type type) { | 87 Profile* profile, const std::string& name, Manifest::Type type) { |
| 88 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 87 scoped_refptr<Extension> extension = GetExtension(profile, name, type); | 89 scoped_refptr<Extension> extension = GetExtension(profile, name, type); |
| 88 if (!extension.get()) { | 90 if (!extension.get()) { |
| 89 NOTREACHED() << "Could not install extension " << name; | 91 NOTREACHED() << "Could not install extension " << name; |
| 90 return std::string(); | 92 return std::string(); |
| 91 } | 93 } |
| 92 extensions::ExtensionSystem::Get(profile) | 94 extensions::ExtensionSystem::Get(profile) |
| 93 ->extension_service() | 95 ->extension_service() |
| 94 ->OnExtensionInstalled(extension.get(), | 96 ->OnExtensionInstalled(extension.get(), |
| 95 syncer::StringOrdinal(), | 97 syncer::StringOrdinal(), |
| 96 extensions::kInstallFlagInstallImmediately); | 98 extensions::kInstallFlagInstallImmediately); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 EXPECT_EQ(expected_id, extension->id()); | 435 EXPECT_EQ(expected_id, extension->id()); |
| 434 return nullptr; | 436 return nullptr; |
| 435 } | 437 } |
| 436 DVLOG(2) << "created extension with name = " | 438 DVLOG(2) << "created extension with name = " |
| 437 << name << ", id = " << expected_id; | 439 << name << ", id = " << expected_id; |
| 438 (it->second)[name] = extension; | 440 (it->second)[name] = extension; |
| 439 id_to_name_[expected_id] = name; | 441 id_to_name_[expected_id] = name; |
| 440 id_to_type_[expected_id] = type; | 442 id_to_type_[expected_id] = type; |
| 441 return extension; | 443 return extension; |
| 442 } | 444 } |
| OLD | NEW |