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

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

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving ng browser unittest issues Created 5 years, 7 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
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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
19 #include "base/stl_util.h" 19 #include "base/stl_util.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_split.h" 21 #include "base/strings/string_split.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/thread_task_runner_handle.h"
24 #include "base/threading/thread.h" 25 #include "base/threading/thread.h"
25 #include "base/version.h" 26 #include "base/version.h"
26 #include "chrome/browser/chrome_notification_types.h" 27 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/extensions/crx_installer.h" 28 #include "chrome/browser/extensions/crx_installer.h"
28 #include "chrome/browser/extensions/extension_error_reporter.h" 29 #include "chrome/browser/extensions/extension_error_reporter.h"
29 #include "chrome/browser/extensions/extension_sync_data.h" 30 #include "chrome/browser/extensions/extension_sync_data.h"
30 #include "chrome/browser/extensions/test_extension_prefs.h" 31 #include "chrome/browser/extensions/test_extension_prefs.h"
31 #include "chrome/browser/extensions/test_extension_service.h" 32 #include "chrome/browser/extensions/test_extension_service.h"
32 #include "chrome/browser/extensions/test_extension_system.h" 33 #include "chrome/browser/extensions/test_extension_system.h"
33 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory. h" 34 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory. h"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // inside this class (which is a friend to ExtensionUpdater). 641 // inside this class (which is a friend to ExtensionUpdater).
641 class ExtensionUpdaterTest : public testing::Test { 642 class ExtensionUpdaterTest : public testing::Test {
642 public: 643 public:
643 ExtensionUpdaterTest() 644 ExtensionUpdaterTest()
644 : thread_bundle_( 645 : thread_bundle_(
645 content::TestBrowserThreadBundle::IO_MAINLOOP), 646 content::TestBrowserThreadBundle::IO_MAINLOOP),
646 testing_local_state_(TestingBrowserProcess::GetGlobal()) { 647 testing_local_state_(TestingBrowserProcess::GetGlobal()) {
647 } 648 }
648 649
649 void SetUp() override { 650 void SetUp() override {
650 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); 651 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get()));
651 } 652 }
652 653
653 void TearDown() override { 654 void TearDown() override {
654 // Some tests create URLRequestContextGetters, whose destruction must run 655 // Some tests create URLRequestContextGetters, whose destruction must run
655 // on the IO thread. Make sure the IO loop spins before shutdown so that 656 // on the IO thread. Make sure the IO loop spins before shutdown so that
656 // those objects are released. 657 // those objects are released.
657 RunUntilIdle(); 658 RunUntilIdle();
658 prefs_.reset(); 659 prefs_.reset();
659 } 660 }
660 661
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 // on the delta between now and the last ping time (or in the case of active 1612 // on the delta between now and the last ping time (or in the case of active
1612 // pings, that delta plus whether the app has been active). 1613 // pings, that delta plus whether the app has been active).
1613 void TestGalleryRequests(int rollcall_ping_days, 1614 void TestGalleryRequests(int rollcall_ping_days,
1614 int active_ping_days, 1615 int active_ping_days,
1615 bool active_bit, 1616 bool active_bit,
1616 bool expect_brand_code) { 1617 bool expect_brand_code) {
1617 net::TestURLFetcherFactory factory; 1618 net::TestURLFetcherFactory factory;
1618 1619
1619 // Set up 2 mock extensions, one with a google.com update url and one 1620 // Set up 2 mock extensions, one with a google.com update url and one
1620 // without. 1621 // without.
1621 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); 1622 prefs_.reset(new TestExtensionPrefs(base::ThreadTaskRunnerHandle::Get()));
1622 ServiceForManifestTests service(prefs_.get()); 1623 ServiceForManifestTests service(prefs_.get());
1623 ExtensionList tmp; 1624 ExtensionList tmp;
1624 GURL url1("http://clients2.google.com/service/update2/crx"); 1625 GURL url1("http://clients2.google.com/service/update2/crx");
1625 GURL url2("http://www.somewebsite.com"); 1626 GURL url2("http://www.somewebsite.com");
1626 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), 1627 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(),
1627 Manifest::INTERNAL); 1628 Manifest::INTERNAL);
1628 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), 1629 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(),
1629 Manifest::INTERNAL); 1630 Manifest::INTERNAL);
1630 EXPECT_EQ(2u, tmp.size()); 1631 EXPECT_EQ(2u, tmp.size());
1631 service.set_extensions(tmp, ExtensionList()); 1632 service.set_extensions(tmp, ExtensionList());
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 // -prodversionmin (shouldn't update if browser version too old) 2251 // -prodversionmin (shouldn't update if browser version too old)
2251 // -manifests & updates arriving out of order / interleaved 2252 // -manifests & updates arriving out of order / interleaved
2252 // -malformed update url (empty, file://, has query, has a # fragment, etc.) 2253 // -malformed update url (empty, file://, has query, has a # fragment, etc.)
2253 // -An extension gets uninstalled while updates are in progress (so it doesn't 2254 // -An extension gets uninstalled while updates are in progress (so it doesn't
2254 // "come back from the dead") 2255 // "come back from the dead")
2255 // -An extension gets manually updated to v3 while we're downloading v2 (ie 2256 // -An extension gets manually updated to v3 while we're downloading v2 (ie
2256 // you don't get downgraded accidentally) 2257 // you don't get downgraded accidentally)
2257 // -An update manifest mentions multiple updates 2258 // -An update manifest mentions multiple updates
2258 2259
2259 } // namespace extensions 2260 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_blacklist_state_fetcher.cc ('k') | chrome/browser/extensions/webstore_install_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698