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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "chrome/common/chrome_constants.h" 66 #include "chrome/common/chrome_constants.h"
67 #include "chrome/common/chrome_switches.h" 67 #include "chrome/common/chrome_switches.h"
68 #include "chrome/common/extensions/api/plugins/plugins_handler.h" 68 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
69 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 69 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
70 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" 70 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
71 #include "chrome/common/extensions/manifest_url_handler.h" 71 #include "chrome/common/extensions/manifest_url_handler.h"
72 #include "chrome/common/pref_names.h" 72 #include "chrome/common/pref_names.h"
73 #include "chrome/common/url_constants.h" 73 #include "chrome/common/url_constants.h"
74 #include "chrome/test/base/scoped_browser_locale.h" 74 #include "chrome/test/base/scoped_browser_locale.h"
75 #include "chrome/test/base/testing_profile.h" 75 #include "chrome/test/base/testing_profile.h"
76 #include "components/crx_file/id_util.h"
76 #include "components/pref_registry/pref_registry_syncable.h" 77 #include "components/pref_registry/pref_registry_syncable.h"
77 #include "content/public/browser/dom_storage_context.h" 78 #include "content/public/browser/dom_storage_context.h"
78 #include "content/public/browser/gpu_data_manager.h" 79 #include "content/public/browser/gpu_data_manager.h"
79 #include "content/public/browser/indexed_db_context.h" 80 #include "content/public/browser/indexed_db_context.h"
80 #include "content/public/browser/notification_registrar.h" 81 #include "content/public/browser/notification_registrar.h"
81 #include "content/public/browser/notification_service.h" 82 #include "content/public/browser/notification_service.h"
82 #include "content/public/browser/plugin_service.h" 83 #include "content/public/browser/plugin_service.h"
83 #include "content/public/browser/render_process_host.h" 84 #include "content/public/browser/render_process_host.h"
84 #include "content/public/browser/storage_partition.h" 85 #include "content/public/browser/storage_partition.h"
85 #include "content/public/common/content_constants.h" 86 #include "content/public/common/content_constants.h"
(...skipping 4483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4569 // Tests that we generate IDs when they are not specified in the manifest for 4570 // Tests that we generate IDs when they are not specified in the manifest for
4570 // --load-extension. 4571 // --load-extension.
4571 TEST_F(ExtensionServiceTest, GenerateID) { 4572 TEST_F(ExtensionServiceTest, GenerateID) {
4572 InitializeEmptyExtensionService(); 4573 InitializeEmptyExtensionService();
4573 4574
4574 base::FilePath no_id_ext = data_dir().AppendASCII("no_id"); 4575 base::FilePath no_id_ext = data_dir().AppendASCII("no_id");
4575 extensions::UnpackedInstaller::Create(service())->Load(no_id_ext); 4576 extensions::UnpackedInstaller::Create(service())->Load(no_id_ext);
4576 base::RunLoop().RunUntilIdle(); 4577 base::RunLoop().RunUntilIdle();
4577 EXPECT_EQ(0u, GetErrors().size()); 4578 EXPECT_EQ(0u, GetErrors().size());
4578 ASSERT_EQ(1u, loaded_.size()); 4579 ASSERT_EQ(1u, loaded_.size());
4579 ASSERT_TRUE(Extension::IdIsValid(loaded_[0]->id())); 4580 ASSERT_TRUE(crx_file::id_util::IdIsValid(loaded_[0]->id()));
4580 EXPECT_EQ(loaded_[0]->location(), Manifest::UNPACKED); 4581 EXPECT_EQ(loaded_[0]->location(), Manifest::UNPACKED);
4581 4582
4582 ValidatePrefKeyCount(1); 4583 ValidatePrefKeyCount(1);
4583 4584
4584 std::string previous_id = loaded_[0]->id(); 4585 std::string previous_id = loaded_[0]->id();
4585 4586
4586 // If we reload the same path, we should get the same extension ID. 4587 // If we reload the same path, we should get the same extension ID.
4587 extensions::UnpackedInstaller::Create(service())->Load(no_id_ext); 4588 extensions::UnpackedInstaller::Create(service())->Load(no_id_ext);
4588 base::RunLoop().RunUntilIdle(); 4589 base::RunLoop().RunUntilIdle();
4589 ASSERT_EQ(1u, loaded_.size()); 4590 ASSERT_EQ(1u, loaded_.size());
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 7153
7153 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 7154 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
7154 content::Source<Profile>(profile()), 7155 content::Source<Profile>(profile()),
7155 content::NotificationService::NoDetails()); 7156 content::NotificationService::NoDetails());
7156 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 7157 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
7157 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 7158 EXPECT_EQ(0u, registry()->enabled_extensions().size());
7158 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 7159 EXPECT_EQ(0u, registry()->disabled_extensions().size());
7159 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 7160 EXPECT_EQ(0u, registry()->terminated_extensions().size());
7160 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 7161 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
7161 } 7162 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698