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

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

Issue 8789018: Revert 113047 - Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 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/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 content::NotificationRegistrar registrar; 65 content::NotificationRegistrar registrar;
66 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 66 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
67 content::NotificationService::AllSources()); 67 content::NotificationService::AllSources());
68 scoped_refptr<extensions::UnpackedInstaller> installer( 68 scoped_refptr<extensions::UnpackedInstaller> installer(
69 extensions::UnpackedInstaller::Create(service)); 69 extensions::UnpackedInstaller::Create(service));
70 installer->set_prompt_for_plugins(false); 70 installer->set_prompt_for_plugins(false);
71 installer->Load(path); 71 installer->Load(path);
72 ui_test_utils::RunMessageLoop(); 72 ui_test_utils::RunMessageLoop();
73 } 73 }
74 74
75 // Find the loaded extension by its path. See crbug.com/59531 for why 75 // Find the extension by iterating backwards since it is likely last.
76 // we cannot just use last_loaded_extension_id_.
77 FilePath extension_path = path; 76 FilePath extension_path = path;
78 file_util::AbsolutePath(&extension_path); 77 file_util::AbsolutePath(&extension_path);
79 const Extension* extension = NULL; 78 const Extension* extension = NULL;
80 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); 79 for (ExtensionList::const_reverse_iterator iter =
81 iter != service->extensions()->end(); ++iter) { 80 service->extensions()->rbegin();
81 iter != service->extensions()->rend(); ++iter) {
82 if ((*iter)->path() == extension_path) { 82 if ((*iter)->path() == extension_path) {
83 extension = *iter; 83 extension = *iter;
84 break; 84 break;
85 } 85 }
86 } 86 }
87 if (!extension) 87 if (!extension)
88 return NULL; 88 return NULL;
89 89
90 const std::string extension_id = extension->id(); 90 const std::string extension_id = extension->id();
91 91
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ui_test_utils::RunMessageLoop(); 289 ui_test_utils::RunMessageLoop();
290 } 290 }
291 291
292 size_t num_after = service->extensions()->size(); 292 size_t num_after = service->extensions()->size();
293 EXPECT_EQ(num_before + expected_change, num_after); 293 EXPECT_EQ(num_before + expected_change, num_after);
294 if (num_before + expected_change != num_after) { 294 if (num_before + expected_change != num_after) {
295 VLOG(1) << "Num extensions before: " << base::IntToString(num_before) 295 VLOG(1) << "Num extensions before: " << base::IntToString(num_before)
296 << " num after: " << base::IntToString(num_after) 296 << " num after: " << base::IntToString(num_after)
297 << " Installed extensions follow:"; 297 << " Installed extensions follow:";
298 298
299 for (ExtensionSet::const_iterator it = service->extensions()->begin(); 299 for (size_t i = 0; i < service->extensions()->size(); ++i)
300 it != service->extensions()->end(); ++it) 300 VLOG(1) << " " << (*service->extensions())[i]->id();
301 VLOG(1) << " " << (*it)->id();
302 301
303 VLOG(1) << "Errors follow:"; 302 VLOG(1) << "Errors follow:";
304 const std::vector<std::string>* errors = 303 const std::vector<std::string>* errors =
305 ExtensionErrorReporter::GetInstance()->GetErrors(); 304 ExtensionErrorReporter::GetInstance()->GetErrors();
306 for (std::vector<std::string>::const_iterator iter = errors->begin(); 305 for (std::vector<std::string>::const_iterator iter = errors->begin();
307 iter != errors->end(); ++iter) 306 iter != errors->end(); ++iter)
308 VLOG(1) << *iter; 307 VLOG(1) << *iter;
309 308
310 return NULL; 309 return NULL;
311 } 310 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 MessageLoopForUI::current()->Quit(); 497 MessageLoopForUI::current()->Quit();
499 } 498 }
500 break; 499 break;
501 } 500 }
502 501
503 default: 502 default:
504 NOTREACHED(); 503 NOTREACHED();
505 break; 504 break;
506 } 505 }
507 } 506 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/extensions/extension_browsertests_misc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698