OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/pending_extension_info.h" | 12 #include "chrome/browser/extensions/pending_extension_info.h" |
13 #include "chrome/browser/extensions/pending_extension_manager.h" | 13 #include "chrome/browser/extensions/pending_extension_manager.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
16 #include "chrome/common/string_ordinal.h" | |
17 #include "chrome/browser/sync/test/integration/sync_test.h" | 16 #include "chrome/browser/sync/test/integration/sync_test.h" |
18 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 17 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 | 19 |
21 SyncExtensionHelper::ExtensionState::ExtensionState() | 20 SyncExtensionHelper::ExtensionState::ExtensionState() |
22 : enabled_state(ENABLED), incognito_enabled(false) {} | 21 : enabled_state(ENABLED), incognito_enabled(false) {} |
23 | 22 |
24 SyncExtensionHelper::ExtensionState::~ExtensionState() {} | 23 SyncExtensionHelper::ExtensionState::~ExtensionState() {} |
25 | 24 |
26 bool SyncExtensionHelper::ExtensionState::Equals( | 25 bool SyncExtensionHelper::ExtensionState::Equals( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 57 |
59 setup_completed_ = true; | 58 setup_completed_ = true; |
60 } | 59 } |
61 | 60 |
62 void SyncExtensionHelper::InstallExtension( | 61 void SyncExtensionHelper::InstallExtension( |
63 Profile* profile, const std::string& name, Extension::Type type) { | 62 Profile* profile, const std::string& name, Extension::Type type) { |
64 scoped_refptr<Extension> extension = GetExtension(profile, name, type); | 63 scoped_refptr<Extension> extension = GetExtension(profile, name, type); |
65 ASSERT_TRUE(extension.get()) << "Could not get extension " << name | 64 ASSERT_TRUE(extension.get()) << "Could not get extension " << name |
66 << " (profile = " << profile << ")"; | 65 << " (profile = " << profile << ")"; |
67 profile->GetExtensionService()->OnExtensionInstalled( | 66 profile->GetExtensionService()->OnExtensionInstalled( |
68 extension, extension->UpdatesFromGallery(), StringOrdinal()); | 67 extension, extension->UpdatesFromGallery(), 0); |
69 } | 68 } |
70 | 69 |
71 void SyncExtensionHelper::UninstallExtension( | 70 void SyncExtensionHelper::UninstallExtension( |
72 Profile* profile, const std::string& name) { | 71 Profile* profile, const std::string& name) { |
73 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), | 72 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), |
74 NameToId(name)); | 73 NameToId(name)); |
75 } | 74 } |
76 | 75 |
77 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( | 76 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( |
78 Profile* profile) const { | 77 Profile* profile) const { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (extension->id() != expected_id) { | 352 if (extension->id() != expected_id) { |
354 EXPECT_EQ(expected_id, extension->id()); | 353 EXPECT_EQ(expected_id, extension->id()); |
355 return NULL; | 354 return NULL; |
356 } | 355 } |
357 DVLOG(2) << "created extension with name = " | 356 DVLOG(2) << "created extension with name = " |
358 << name << ", id = " << expected_id; | 357 << name << ", id = " << expected_id; |
359 (it->second)[name] = extension; | 358 (it->second)[name] = extension; |
360 id_to_name_[expected_id] = name; | 359 id_to_name_[expected_id] = name; |
361 return extension; | 360 return extension; |
362 } | 361 } |
OLD | NEW |