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

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

Issue 2923013006: [Extensions Sync] Don't apply sync data for unsyncable extensions (Closed)
Patch Set: lazyboy's Created 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_sync_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/extensions/chrome_test_extension_loader.h" 5 #include "chrome/browser/extensions/chrome_test_extension_loader.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 .WaitForExtensionViewsToLoad(); 97 .WaitForExtensionViewsToLoad();
98 } 98 }
99 99
100 base::FilePath ChromeTestExtensionLoader::PackExtension( 100 base::FilePath ChromeTestExtensionLoader::PackExtension(
101 const base::FilePath& unpacked_path) { 101 const base::FilePath& unpacked_path) {
102 if (!base::PathExists(unpacked_path)) { 102 if (!base::PathExists(unpacked_path)) {
103 ADD_FAILURE() << "Unpacked path does not exist: " << unpacked_path.value(); 103 ADD_FAILURE() << "Unpacked path does not exist: " << unpacked_path.value();
104 return base::FilePath(); 104 return base::FilePath();
105 } 105 }
106 106
107 if (!temp_dir_.CreateUniqueTempDir()) {
108 ADD_FAILURE() << "Could not create unique temp dir.";
109 return base::FilePath();
110 }
107 base::FilePath crx_path = temp_dir_.GetPath().AppendASCII("temp.crx"); 111 base::FilePath crx_path = temp_dir_.GetPath().AppendASCII("temp.crx");
108 if (base::PathExists(crx_path)) { 112 if (base::PathExists(crx_path)) {
109 ADD_FAILURE() << "Crx path exists: " << crx_path.value() 113 ADD_FAILURE() << "Crx path exists: " << crx_path.value()
110 << ", are you trying to reuse the same ChromeTestExtensionLoader?"; 114 << ", are you trying to reuse the same ChromeTestExtensionLoader?";
111 return base::FilePath(); 115 return base::FilePath();
112 } 116 }
113 base::FilePath fallback_pem_path = 117 base::FilePath fallback_pem_path =
114 temp_dir_.GetPath().AppendASCII("temp.pem"); 118 temp_dir_.GetPath().AppendASCII("temp.pem");
115 if (base::PathExists(fallback_pem_path)) { 119 if (base::PathExists(fallback_pem_path)) {
116 ADD_FAILURE() << "PEM path exists: " << fallback_pem_path.value() 120 ADD_FAILURE() << "PEM path exists: " << fallback_pem_path.value()
117 << ", are you trying to reuse the same ChromeTestExtensionLoader?"; 121 << ", are you trying to reuse the same ChromeTestExtensionLoader?";
118 return base::FilePath(); 122 return base::FilePath();
119 } 123 }
120 124
121 base::FilePath* pem_path_to_use = &fallback_pem_path; 125 base::FilePath empty_path;
126 base::FilePath* pem_path_to_use = &empty_path;
122 if (!pem_path_.empty()) { 127 if (!pem_path_.empty()) {
123 pem_path_to_use = &pem_path_; 128 pem_path_to_use = &pem_path_;
124 if (!base::PathExists(pem_path_)) { 129 if (!base::PathExists(pem_path_)) {
125 ADD_FAILURE() << "Provided PEM path does not exist: " 130 ADD_FAILURE() << "Provided PEM path does not exist: "
126 << pem_path_.value(); 131 << pem_path_.value();
127 return base::FilePath(); 132 return base::FilePath();
128 } 133 }
129 } 134 }
130 135
131 ExtensionCreator creator; 136 ExtensionCreator creator;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 227
223 std::string install_warnings_message = "Unexpected warnings for extension:\n"; 228 std::string install_warnings_message = "Unexpected warnings for extension:\n";
224 for (const InstallWarning& warning : install_warnings) 229 for (const InstallWarning& warning : install_warnings)
225 install_warnings_message += " " + warning.message + "\n"; 230 install_warnings_message += " " + warning.message + "\n";
226 231
227 ADD_FAILURE() << install_warnings_message; 232 ADD_FAILURE() << install_warnings_message;
228 return false; 233 return false;
229 } 234 }
230 235
231 } // namespace extensions 236 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698