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

Side by Side Diff: chrome/browser/extensions/updater/extension_updater_unittest.cc

Issue 16295003: Update chrome/ 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, 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 | Annotate | Revision Log
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 <list> 5 #include <list>
6 #include <map> 6 #include <map>
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 for (int i = 1; i <= count; i++) { 244 for (int i = 1; i <= count; i++) {
245 DictionaryValue manifest; 245 DictionaryValue manifest;
246 manifest.SetString(extension_manifest_keys::kVersion, 246 manifest.SetString(extension_manifest_keys::kVersion,
247 base::StringPrintf("%d.0.0.0", i)); 247 base::StringPrintf("%d.0.0.0", i));
248 manifest.SetString(extension_manifest_keys::kName, 248 manifest.SetString(extension_manifest_keys::kName,
249 base::StringPrintf("Extension %d.%d", id, i)); 249 base::StringPrintf("Extension %d.%d", id, i));
250 if (update_url) 250 if (update_url)
251 manifest.SetString(extension_manifest_keys::kUpdateURL, *update_url); 251 manifest.SetString(extension_manifest_keys::kUpdateURL, *update_url);
252 scoped_refptr<Extension> e = 252 scoped_refptr<Extension> e =
253 prefs_->AddExtensionWithManifest(manifest, location); 253 prefs_->AddExtensionWithManifest(manifest, location);
254 ASSERT_TRUE(e != NULL); 254 ASSERT_TRUE(e.get() != NULL);
255 list->push_back(e); 255 list->push_back(e);
256 } 256 }
257 } 257 }
258 258
259 protected: 259 protected:
260 TestExtensionPrefs* const prefs_; 260 TestExtensionPrefs* const prefs_;
261 PendingExtensionManager pending_extension_manager_; 261 PendingExtensionManager pending_extension_manager_;
262 TestingProfile profile_; 262 TestingProfile profile_;
263 Blacklist blacklist_; 263 Blacklist blacklist_;
264 264
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 MockExtensionDownloaderDelegate delegate; 682 MockExtensionDownloaderDelegate delegate;
683 ExtensionDownloader downloader(&delegate, service.request_context()); 683 ExtensionDownloader downloader(&delegate, service.request_context());
684 ExtensionList extensions; 684 ExtensionList extensions;
685 std::string url(gallery_url); 685 std::string url(gallery_url);
686 686
687 service.CreateTestExtensions(1, 1, &extensions, &url, Manifest::INTERNAL); 687 service.CreateTestExtensions(1, 1, &extensions, &url, Manifest::INTERNAL);
688 688
689 const std::string& id = extensions[0]->id(); 689 const std::string& id = extensions[0]->id();
690 EXPECT_CALL(delegate, GetPingDataForExtension(id, _)); 690 EXPECT_CALL(delegate, GetPingDataForExtension(id, _));
691 691
692 downloader.AddExtension(*extensions[0], 0); 692 downloader.AddExtension(*extensions[0].get(), 0);
693 downloader.StartAllPending(); 693 downloader.StartAllPending();
694 net::TestURLFetcher* fetcher = 694 net::TestURLFetcher* fetcher =
695 factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); 695 factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId);
696 ASSERT_TRUE(fetcher); 696 ASSERT_TRUE(fetcher);
697 // Make sure that extensions that update from the gallery ignore any 697 // Make sure that extensions that update from the gallery ignore any
698 // update URL data. 698 // update URL data.
699 const std::string& update_url = fetcher->GetOriginalURL().spec(); 699 const std::string& update_url = fetcher->GetOriginalURL().spec();
700 std::string::size_type x = update_url.find("x="); 700 std::string::size_type x = update_url.find("x=");
701 EXPECT_NE(std::string::npos, x); 701 EXPECT_NE(std::string::npos, x);
702 std::string::size_type ap = update_url.find("ap%3D", x); 702 std::string::size_type ap = update_url.find("ap%3D", x);
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 1440
1441 ExtensionUpdater updater( 1441 ExtensionUpdater updater(
1442 &service, service.extension_prefs(), service.pref_service(), 1442 &service, service.extension_prefs(), service.pref_service(),
1443 service.profile(), service.blacklist(), kUpdateFrequencySecs); 1443 service.profile(), service.blacklist(), kUpdateFrequencySecs);
1444 updater.Start(); 1444 updater.Start();
1445 ResetDownloader( 1445 ResetDownloader(
1446 &updater, 1446 &updater,
1447 new ExtensionDownloader(&updater, service.request_context())); 1447 new ExtensionDownloader(&updater, service.request_context()));
1448 1448
1449 ManifestFetchData fetch_data(update_url, 0); 1449 ManifestFetchData fetch_data(update_url, 0);
1450 const Extension* extension = tmp[0]; 1450 const Extension* extension = tmp[0].get();
1451 fetch_data.AddExtension(extension->id(), 1451 fetch_data.AddExtension(extension->id(),
1452 extension->VersionString(), 1452 extension->VersionString(),
1453 &kNeverPingedData, 1453 &kNeverPingedData,
1454 kEmptyUpdateUrlData, 1454 kEmptyUpdateUrlData,
1455 std::string()); 1455 std::string());
1456 UpdateManifest::Results results; 1456 UpdateManifest::Results results;
1457 results.daystart_elapsed_seconds = 750; 1457 results.daystart_elapsed_seconds = 750;
1458 1458
1459 updater.downloader_->HandleManifestResults(fetch_data, &results); 1459 updater.downloader_->HandleManifestResults(fetch_data, &results);
1460 Time last_ping_day = 1460 Time last_ping_day =
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 // -prodversionmin (shouldn't update if browser version too old) 1728 // -prodversionmin (shouldn't update if browser version too old)
1729 // -manifests & updates arriving out of order / interleaved 1729 // -manifests & updates arriving out of order / interleaved
1730 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 1730 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
1731 // -An extension gets uninstalled while updates are in progress (so it doesn't 1731 // -An extension gets uninstalled while updates are in progress (so it doesn't
1732 // "come back from the dead") 1732 // "come back from the dead")
1733 // -An extension gets manually updated to v3 while we're downloading v2 (ie 1733 // -An extension gets manually updated to v3 while we're downloading v2 (ie
1734 // you don't get downgraded accidentally) 1734 // you don't get downgraded accidentally)
1735 // -An update manifest mentions multiple updates 1735 // -An update manifest mentions multiple updates
1736 1736
1737 } // namespace extensions 1737 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.cc ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698