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

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

Issue 17948002: Update Linux to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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 "chrome/browser/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const char* const good_crx = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; 151 const char* const good_crx = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
152 const char* const hosted_app = "kbmnembihfiondgfjekmnmcbddelicoi"; 152 const char* const hosted_app = "kbmnembihfiondgfjekmnmcbddelicoi";
153 const char* const page_action = "obcimlgaoabeegjmmpldobjndiealpln"; 153 const char* const page_action = "obcimlgaoabeegjmmpldobjndiealpln";
154 const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad"; 154 const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad";
155 const char* const theme2_crx = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; 155 const char* const theme2_crx = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf";
156 const char* const permissions_crx = "eagpmdpfmaekmmcejjbmjoecnejeiiin"; 156 const char* const permissions_crx = "eagpmdpfmaekmmcejjbmjoecnejeiiin";
157 const char* const unpacked = "cbcdidchbppangcjoddlpdjlenngjldk"; 157 const char* const unpacked = "cbcdidchbppangcjoddlpdjlenngjldk";
158 const char* const updates_from_webstore = "akjooamlhcgeopfifcmlggaebeocgokj"; 158 const char* const updates_from_webstore = "akjooamlhcgeopfifcmlggaebeocgokj";
159 159
160 struct ExtensionsOrder { 160 struct ExtensionsOrder {
161 bool operator()(const Extension* a, const Extension* b) { 161 bool operator()(const scoped_refptr<const Extension>& a,
162 const scoped_refptr<const Extension>& b) {
162 return a->name() < b->name(); 163 return a->name() < b->name();
163 } 164 }
164 }; 165 };
165 166
166 static std::vector<string16> GetErrors() { 167 static std::vector<string16> GetErrors() {
167 const std::vector<string16>* errors = 168 const std::vector<string16>* errors =
168 ExtensionErrorReporter::GetInstance()->GetErrors(); 169 ExtensionErrorReporter::GetInstance()->GetErrors();
169 std::vector<string16> ret_val; 170 std::vector<string16> ret_val;
170 171
171 for (std::vector<string16>::const_iterator iter = errors->begin(); 172 for (std::vector<string16>::const_iterator iter = errors->begin();
(...skipping 3829 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); 4002 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path));
4002 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); 4003 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0));
4003 EXPECT_TRUE(file_util::PathExists(lso_file_path)); 4004 EXPECT_TRUE(file_util::PathExists(lso_file_path));
4004 4005
4005 // Create indexed db. Similarly, it is enough to only simulate this by 4006 // Create indexed db. Similarly, it is enough to only simulate this by
4006 // creating the directory on the disk. 4007 // creating the directory on the disk.
4007 IndexedDBContext* idb_context = 4008 IndexedDBContext* idb_context =
4008 BrowserContext::GetDefaultStoragePartition(profile_.get())-> 4009 BrowserContext::GetDefaultStoragePartition(profile_.get())->
4009 GetIndexedDBContext(); 4010 GetIndexedDBContext();
4010 idb_context->SetTaskRunnerForTesting( 4011 idb_context->SetTaskRunnerForTesting(
4011 base::MessageLoop::current()->message_loop_proxy()); 4012 base::MessageLoop::current()->message_loop_proxy().get());
4012 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); 4013 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id);
4013 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); 4014 EXPECT_TRUE(file_util::CreateDirectory(idb_path));
4014 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); 4015 EXPECT_TRUE(file_util::DirectoryExists(idb_path));
4015 4016
4016 // Uninstall the extension. 4017 // Uninstall the extension.
4017 service_->UninstallExtension(good_crx, false, NULL); 4018 service_->UninstallExtension(good_crx, false, NULL);
4018 loop_.RunUntilIdle(); 4019 loop_.RunUntilIdle();
4019 4020
4020 // Check that the cookie is gone. 4021 // Check that the cookie is gone.
4021 cookie_monster->GetAllCookiesForURLAsync( 4022 cookie_monster->GetAllCookiesForURLAsync(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
4118 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); 4119 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path));
4119 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); 4120 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0));
4120 EXPECT_TRUE(file_util::PathExists(lso_file_path)); 4121 EXPECT_TRUE(file_util::PathExists(lso_file_path));
4121 4122
4122 // Create indexed db. Similarly, it is enough to only simulate this by 4123 // Create indexed db. Similarly, it is enough to only simulate this by
4123 // creating the directory on the disk. 4124 // creating the directory on the disk.
4124 IndexedDBContext* idb_context = 4125 IndexedDBContext* idb_context =
4125 BrowserContext::GetDefaultStoragePartition(profile_.get())-> 4126 BrowserContext::GetDefaultStoragePartition(profile_.get())->
4126 GetIndexedDBContext(); 4127 GetIndexedDBContext();
4127 idb_context->SetTaskRunnerForTesting( 4128 idb_context->SetTaskRunnerForTesting(
4128 base::MessageLoop::current()->message_loop_proxy()); 4129 base::MessageLoop::current()->message_loop_proxy().get());
4129 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); 4130 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id);
4130 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); 4131 EXPECT_TRUE(file_util::CreateDirectory(idb_path));
4131 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); 4132 EXPECT_TRUE(file_util::DirectoryExists(idb_path));
4132 4133
4133 // Uninstall one of them, unlimited storage should still be granted 4134 // Uninstall one of them, unlimited storage should still be granted
4134 // to the origin. 4135 // to the origin.
4135 UninstallExtension(id1, false); 4136 UninstallExtension(id1, false);
4136 EXPECT_EQ(1u, service_->extensions()->size()); 4137 EXPECT_EQ(1u, service_->extensions()->size());
4137 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> 4138 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()->
4138 IsStorageUnlimited(origin1)); 4139 IsStorageUnlimited(origin1));
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
6094 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); 6095 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF);
6095 AddMockExternalProvider(provider); 6096 AddMockExternalProvider(provider);
6096 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); 6097 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path);
6097 6098
6098 service_->CheckForExternalUpdates(); 6099 service_->CheckForExternalUpdates();
6099 loop_.RunUntilIdle(); 6100 loop_.RunUntilIdle();
6100 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); 6101 EXPECT_TRUE(extensions::HasExternalInstallError(service_));
6101 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); 6102 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_));
6102 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); 6103 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore));
6103 } 6104 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/nacl_host/nacl_file_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698