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

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

Issue 2045833003: Fix HotwordServiceTest under ubsan: no more vcalls on garbage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix two more test cases Created 4 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/search/hotword_service_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 (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/extensions/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 component_loader_.AddDefaultComponentExtensions(false); 239 component_loader_.AddDefaultComponentExtensions(false);
240 component_loader_.LoadAll(); 240 component_loader_.LoadAll();
241 unsigned int default_count = registry->enabled_extensions().size(); 241 unsigned int default_count = registry->enabled_extensions().size();
242 242
243 // Clear the list of loaded extensions, and reload with one more. 243 // Clear the list of loaded extensions, and reload with one more.
244 extension_service_.clear_extensions(); 244 extension_service_.clear_extensions();
245 component_loader_.Add(manifest_contents_, extension_path_); 245 component_loader_.Add(manifest_contents_, extension_path_);
246 component_loader_.LoadAll(); 246 component_loader_.LoadAll();
247 247
248 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); 248 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size());
249
250 base::MessageLoop::current()->RunUntilIdle();
249 } 251 }
250 252
251 TEST_F(ComponentLoaderTest, AddOrReplace) { 253 TEST_F(ComponentLoaderTest, AddOrReplace) {
252 EXPECT_EQ(0u, component_loader_.registered_extensions_count()); 254 EXPECT_EQ(0u, component_loader_.registered_extensions_count());
253 component_loader_.AddDefaultComponentExtensions(false); 255 component_loader_.AddDefaultComponentExtensions(false);
254 size_t const default_count = component_loader_.registered_extensions_count(); 256 size_t const default_count = component_loader_.registered_extensions_count();
255 base::FilePath known_extension = GetBasePath() 257 base::FilePath known_extension = GetBasePath()
256 .AppendASCII("override_component_extension"); 258 .AppendASCII("override_component_extension");
257 base::FilePath unknow_extension = extension_path_; 259 base::FilePath unknow_extension = extension_path_;
258 base::FilePath invalid_extension = GetBasePath() 260 base::FilePath invalid_extension = GetBasePath()
(...skipping 17 matching lines...) Expand all
276 EXPECT_EQ(0u, extension_service_.unloaded_count()); 278 EXPECT_EQ(0u, extension_service_.unloaded_count());
277 279
278 // replace loaded component extension. 280 // replace loaded component extension.
279 component_loader_.AddOrReplace(known_extension); 281 component_loader_.AddOrReplace(known_extension);
280 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); 282 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size());
281 EXPECT_EQ(1u, extension_service_.unloaded_count()); 283 EXPECT_EQ(1u, extension_service_.unloaded_count());
282 284
283 // Add an invalid component extension. 285 // Add an invalid component extension.
284 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); 286 std::string extension_id = component_loader_.AddOrReplace(invalid_extension);
285 EXPECT_TRUE(extension_id.empty()); 287 EXPECT_TRUE(extension_id.empty());
288 base::MessageLoop::current()->RunUntilIdle();
286 } 289 }
287 290
288 } // namespace extensions 291 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/hotword_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698