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

Unified Diff: chrome/browser/spellchecker/spellcheck_profile_unittest.cc

Issue 7919003: Remove refptr usages from SpellCheckHost (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix pointer returns. Update tests. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_profile_unittest.cc
diff --git a/chrome/browser/spellchecker/spellcheck_profile_unittest.cc b/chrome/browser/spellchecker/spellcheck_profile_unittest.cc
index 4e03fa9160c5226d58c6166a7b2b9ffd16c32109..ff445d6f4a1d26a053d7f410d62aa2ba4b3daf55 100644
--- a/chrome/browser/spellchecker/spellcheck_profile_unittest.cc
+++ b/chrome/browser/spellchecker/spellcheck_profile_unittest.cc
@@ -39,6 +39,8 @@ class TestingSpellCheckProfile : public SpellCheckProfile {
net::URLRequestContextGetter* request_context,
SpellCheckHostMetrics* metrics) {
create_host_calls_++;
+ returning_from_create_.reset(
+ SpellCheckHost::Create(profile, language, request_context, metrics));
return returning_from_create_.get();
}
@@ -53,11 +55,11 @@ class TestingSpellCheckProfile : public SpellCheckProfile {
void SetHostToBeCreated(MockSpellCheckHost* host) {
EXPECT_CALL(*host, UnsetProfile()).Times(1);
EXPECT_CALL(*host, IsReady()).WillRepeatedly(testing::Return(true));
- returning_from_create_ = host;
+ returning_from_create_.reset(host);
}
size_t create_host_calls_;
- scoped_refptr<SpellCheckHost> returning_from_create_;
+ scoped_ptr<SpellCheckHost> returning_from_create_;
};
typedef SpellCheckProfile::ReinitializeResult ResultType;
@@ -74,7 +76,7 @@ class SpellCheckProfileTest : public testing::Test {
};
TEST_F(SpellCheckProfileTest, ReinitializeEnabled) {
- scoped_refptr<MockSpellCheckHost> host(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host(new MockSpellCheckHost());
TestingSpellCheckProfile target;
target.SetHostToBeCreated(host.get());
@@ -95,9 +97,9 @@ TEST_F(SpellCheckProfileTest, ReinitializeEnabled) {
}
TEST_F(SpellCheckProfileTest, ReinitializeDisabled) {
- scoped_refptr<MockSpellCheckHost> host(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host(new MockSpellCheckHost());
TestingSpellCheckProfile target;
- target.returning_from_create_ = host.get();
+ target.returning_from_create_.reset(host.get());
// If enabled is false, nothing should happen
ResultType result1 = target.ReinitializeHost(false, false, "", NULL);
@@ -111,7 +113,7 @@ TEST_F(SpellCheckProfileTest, ReinitializeDisabled) {
}
TEST_F(SpellCheckProfileTest, ReinitializeRemove) {
- scoped_refptr<MockSpellCheckHost> host(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host(new MockSpellCheckHost());
TestingSpellCheckProfile target;
target.SetHostToBeCreated(host.get());
@@ -130,7 +132,7 @@ TEST_F(SpellCheckProfileTest, ReinitializeRemove) {
}
TEST_F(SpellCheckProfileTest, ReinitializeRecreate) {
- scoped_refptr<MockSpellCheckHost> host1(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host1(new MockSpellCheckHost());
TestingSpellCheckProfile target;
target.SetHostToBeCreated(host1.get());
@@ -142,7 +144,7 @@ TEST_F(SpellCheckProfileTest, ReinitializeRecreate) {
EXPECT_TRUE(target.IsCreatedHostReady());
// Then the host should be re-created if it's forced to recreate.
- scoped_refptr<MockSpellCheckHost> host2(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host2(new MockSpellCheckHost());
target.SetHostToBeCreated(host2.get());
ResultType result2 = target.ReinitializeHost(true, true, "", NULL);
@@ -153,7 +155,7 @@ TEST_F(SpellCheckProfileTest, ReinitializeRecreate) {
}
TEST_F(SpellCheckProfileTest, SpellCheckHostInitializedWithCustomWords) {
- scoped_refptr<MockSpellCheckHost> host(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host(new MockSpellCheckHost());
TestingSpellCheckProfile target;
target.SetHostToBeCreated(host.get());
target.ReinitializeHost(false, true, "", NULL);
@@ -168,7 +170,7 @@ TEST_F(SpellCheckProfileTest, SpellCheckHostInitializedWithCustomWords) {
}
TEST_F(SpellCheckProfileTest, CustomWordAddedLocally) {
- scoped_refptr<MockSpellCheckHost> host(new MockSpellCheckHost());
+ scoped_ptr<MockSpellCheckHost> host(new MockSpellCheckHost());
TestingSpellCheckProfile target;
target.SetHostToBeCreated(host.get());
target.ReinitializeHost(false, true, "", NULL);

Powered by Google App Engine
This is Rietveld 408576698