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

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc

Issue 11413050: chrome/browser: Update calls from RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 "chrome/browser/extensions/api/declarative/rules_registry_service.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/extensions/api/declarative/test_rules_registry.h" 9 #include "chrome/browser/extensions/api/declarative/test_rules_registry.h"
10 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
(...skipping 25 matching lines...) Expand all
36 class RulesRegistryServiceTest : public testing::Test { 36 class RulesRegistryServiceTest : public testing::Test {
37 public: 37 public:
38 RulesRegistryServiceTest() 38 RulesRegistryServiceTest()
39 : ui(content::BrowserThread::UI, &message_loop), 39 : ui(content::BrowserThread::UI, &message_loop),
40 io(content::BrowserThread::IO, &message_loop) {} 40 io(content::BrowserThread::IO, &message_loop) {}
41 41
42 virtual ~RulesRegistryServiceTest() {} 42 virtual ~RulesRegistryServiceTest() {}
43 43
44 virtual void TearDown() OVERRIDE { 44 virtual void TearDown() OVERRIDE {
45 // Make sure that deletion traits of all registries are executed. 45 // Make sure that deletion traits of all registries are executed.
46 message_loop.RunAllPending(); 46 message_loop.RunUntilIdle();
47 } 47 }
48 48
49 protected: 49 protected:
50 MessageLoop message_loop; 50 MessageLoop message_loop;
51 content::TestBrowserThread ui; 51 content::TestBrowserThread ui;
52 content::TestBrowserThread io; 52 content::TestBrowserThread io;
53 }; 53 };
54 54
55 TEST_F(RulesRegistryServiceTest, TestConstructionAndMultiThreading) { 55 TEST_F(RulesRegistryServiceTest, TestConstructionAndMultiThreading) {
56 TestRulesRegistry* ui_registry = new TestRulesRegistry; 56 TestRulesRegistry* ui_registry = new TestRulesRegistry;
(...skipping 25 matching lines...) Expand all
82 content::BrowserThread::PostTask( 82 content::BrowserThread::PostTask(
83 content::BrowserThread::UI, FROM_HERE, 83 content::BrowserThread::UI, FROM_HERE,
84 base::Bind(&VerifyNumberOfRules, 84 base::Bind(&VerifyNumberOfRules,
85 registry_service.GetRulesRegistry("ui"), 1)); 85 registry_service.GetRulesRegistry("ui"), 1));
86 86
87 content::BrowserThread::PostTask( 87 content::BrowserThread::PostTask(
88 content::BrowserThread::IO, FROM_HERE, 88 content::BrowserThread::IO, FROM_HERE,
89 base::Bind(&VerifyNumberOfRules, 89 base::Bind(&VerifyNumberOfRules,
90 registry_service.GetRulesRegistry("io"), 1)); 90 registry_service.GetRulesRegistry("io"), 1));
91 91
92 message_loop.RunAllPending(); 92 message_loop.RunUntilIdle();
93 93
94 // Test extension unloading. 94 // Test extension unloading.
95 95
96 registry_service.SimulateExtensionUnloaded(kExtensionId); 96 registry_service.SimulateExtensionUnloaded(kExtensionId);
97 97
98 content::BrowserThread::PostTask( 98 content::BrowserThread::PostTask(
99 content::BrowserThread::UI, FROM_HERE, 99 content::BrowserThread::UI, FROM_HERE,
100 base::Bind(&VerifyNumberOfRules, 100 base::Bind(&VerifyNumberOfRules,
101 registry_service.GetRulesRegistry("ui"), 0)); 101 registry_service.GetRulesRegistry("ui"), 0));
102 102
103 content::BrowserThread::PostTask( 103 content::BrowserThread::PostTask(
104 content::BrowserThread::IO, FROM_HERE, 104 content::BrowserThread::IO, FROM_HERE,
105 base::Bind(&VerifyNumberOfRules, 105 base::Bind(&VerifyNumberOfRules,
106 registry_service.GetRulesRegistry("io"), 0)); 106 registry_service.GetRulesRegistry("io"), 0));
107 107
108 message_loop.RunAllPending(); 108 message_loop.RunUntilIdle();
109 } 109 }
110 110
111 } // namespace extensions 111 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698