Commit 6c82304c authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in chrome/browser/extensions/activity_log/

This patch was generated by running the rewrite_scoped_refptr clang tool
on a Linux build.

BUG=110610

Review URL: https://codereview.chromium.org/503903004

Cr-Commit-Position: refs/heads/master@{#291838}
parent f01d3e7b
......@@ -82,7 +82,7 @@ bool ActivityDatabaseTestPolicy::FlushDatabase(sql::Connection* db) {
std::vector<scoped_refptr<Action> >::size_type i;
for (i = 0; i < queue_.size(); i++) {
const Action& action = *queue_[i];
const Action& action = *queue_[i].get();
sql::Statement statement(db->GetCachedStatement(
sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
statement.BindString(0, action.extension_id());
......
......@@ -371,7 +371,7 @@ TEST_F(ActivityLogTest, UninstalledExtension) {
action->set_page_url(GURL("http://www.google.com"));
activity_log->OnExtensionUninstalled(
NULL, extension, extensions::UNINSTALL_REASON_FOR_TESTING);
NULL, extension.get(), extensions::UNINSTALL_REASON_FOR_TESTING);
activity_log->GetFilteredActions(
extension->id(),
Action::ACTION_ANY,
......
......@@ -283,7 +283,7 @@ bool CountingPolicy::FlushDatabase(sql::Connection* db) {
insert_str += ")";
for (ActionQueue::iterator i = queue.begin(); i != queue.end(); ++i) {
const Action& action = *i->first;
const Action& action = *i->first.get();
int count = i->second;
base::Time day_start = action.time().LocalMidnight();
......
......@@ -183,37 +183,84 @@ class CountingPolicyTest : public testing::Test {
static void Arguments_Stripped(scoped_ptr<Action::ActionVector> i) {
scoped_refptr<Action> last = i->front();
CheckAction(*last, "odlameecjipmbmbejkplpemijjgpljce",
Action::ACTION_API_CALL, "extension.connect",
"[\"hello\",\"world\"]", "", "", "", 1);
CheckAction(*last.get(),
"odlameecjipmbmbejkplpemijjgpljce",
Action::ACTION_API_CALL,
"extension.connect",
"[\"hello\",\"world\"]",
"",
"",
"",
1);
}
static void Arguments_GetSinglesAction(
scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "http://www.google.com/", "", "", 1);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"http://www.google.com/",
"",
"",
1);
}
static void Arguments_GetTodaysActions(
scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(3, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster",
"", "", "", "", 2);
CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "http://www.google.com/", "", "", 1);
CheckAction(*actions->at(2), "punky", Action::ACTION_API_CALL,
"extension.sendMessage", "[\"not\",\"stripped\"]", "", "", "",
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"",
"",
"",
"",
2);
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"http://www.google.com/",
"",
"",
1);
CheckAction(*actions->at(2).get(),
"punky",
Action::ACTION_API_CALL,
"extension.sendMessage",
"[\"not\",\"stripped\"]",
"",
"",
"",
1);
}
static void Arguments_GetOlderActions(
scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "http://www.google.com/", "", "", 1);
CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
"", "", "", "", 1);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"http://www.google.com/",
"",
"",
1);
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"",
"",
"",
"",
1);
}
static void Arguments_CheckMergeCount(
......@@ -221,8 +268,15 @@ class CountingPolicyTest : public testing::Test {
scoped_ptr<Action::ActionVector> actions) {
if (count > 0) {
ASSERT_EQ(1u, actions->size());
CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster",
"", "", "", "", count);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"",
"",
"",
"",
count);
} else {
ASSERT_EQ(0u, actions->size());
}
......@@ -234,8 +288,15 @@ class CountingPolicyTest : public testing::Test {
scoped_ptr<Action::ActionVector> actions) {
if (count > 0) {
ASSERT_EQ(1u, actions->size());
CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster",
"", "", "", "", count);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"",
"",
"",
"",
count);
ASSERT_EQ(time, actions->at(0)->time());
} else {
ASSERT_EQ(0u, actions->size());
......@@ -244,26 +305,74 @@ class CountingPolicyTest : public testing::Test {
static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "", "", "", 1);
CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "", "", "", 1);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"",
"",
"",
1);
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"",
"",
"",
1);
}
static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(5, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "http://www.google.com/", "Google",
"http://www.args-url.com/", 1);
CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "http://www.google.com/", "Google", "", 1);
CheckAction(*actions->at(2), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "", "", "", 1);
CheckAction(*actions->at(3), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "", "", "http://www.google.com/", 1);
CheckAction(*actions->at(4), "punky", Action::ACTION_DOM_ACCESS, "lets",
"", "", "", "", 1);
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"http://www.google.com/",
"Google",
"http://www.args-url.com/",
1);
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"http://www.google.com/",
"Google",
"",
1);
CheckAction(*actions->at(2).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"",
"",
"",
1);
CheckAction(*actions->at(3).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"",
"",
"http://www.google.com/",
1);
CheckAction(*actions->at(4).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"",
"",
"",
"",
1);
}
static void CheckDuplicates(scoped_ptr<Action::ActionVector> actions) {
......@@ -357,7 +466,7 @@ class CountingPolicyTest : public testing::Test {
static void NoActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -367,7 +476,7 @@ class CountingPolicyTest : public testing::Test {
"http://www.args-url2.com/",
2);
ASSERT_EQ(2, actions->at(0)->action_id());
CheckAction(*actions->at(1),
CheckAction(*actions->at(1).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......@@ -382,7 +491,7 @@ class CountingPolicyTest : public testing::Test {
static void Action1Deleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -397,7 +506,7 @@ class CountingPolicyTest : public testing::Test {
static void Action2Deleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(1, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......
......@@ -81,7 +81,7 @@ bool FullStreamUIPolicy::FlushDatabase(sql::Connection* db) {
Action::ActionVector::size_type i;
for (i = 0; i != queued_actions_.size(); ++i) {
const Action& action = *queued_actions_[i];
const Action& action = *queued_actions_[i].get();
statement.Reset(true);
statement.BindString(0, action.extension_id());
statement.BindInt64(1, action.time().ToInternalValue());
......
......@@ -154,52 +154,121 @@ class FullStreamUIPolicyTest : public testing::Test {
static void Arguments_Present(scoped_ptr<Action::ActionVector> i) {
scoped_refptr<Action> last = i->front();
CheckAction(*last, "odlameecjipmbmbejkplpemijjgpljce",
Action::ACTION_API_CALL, "extension.connect",
"[\"hello\",\"world\"]", "", "", "");
CheckAction(*last.get(),
"odlameecjipmbmbejkplpemijjgpljce",
Action::ACTION_API_CALL,
"extension.connect",
"[\"hello\",\"world\"]",
"",
"",
"");
}
static void Arguments_GetTodaysActions(
scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "http://www.google.com/", "Page Title",
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"http://www.google.com/",
"Page Title",
"http://www.arg-url.com/");
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"[\"woof\"]",
"",
"Page Title",
"http://www.arg-url.com/");
CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
"[\"woof\"]", "", "Page Title", "http://www.arg-url.com/");
}
static void Arguments_GetOlderActions(
scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "http://www.google.com/", "", "");
CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
"[\"woof\"]", "", "", "");
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"http://www.google.com/",
"",
"");
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_API_CALL,
"brewster",
"[\"woof\"]",
"",
"",
"");
}
static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "lets",
"[\"vamoose\"]", "", "", "");
CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "", "", "");
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_API_CALL,
"lets",
"[\"vamoose\"]",
"",
"",
"");
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"",
"",
"");
}
static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(5, static_cast<int>(actions->size()));
CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "http://www.google.com/", "Google",
CheckAction(*actions->at(0).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"http://www.google.com/",
"Google",
"http://www.args-url.com/");
CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "http://www.google.com/", "Google", "");
CheckAction(*actions->at(2), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "", "", "");
CheckAction(*actions->at(3), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "", "", "http://www.google.com/");
CheckAction(*actions->at(4), "punky", Action::ACTION_DOM_ACCESS, "lets",
"[\"vamoose\"]", "", "", "");
CheckAction(*actions->at(1).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"http://www.google.com/",
"Google",
"");
CheckAction(*actions->at(2).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"",
"",
"");
CheckAction(*actions->at(3).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"",
"",
"http://www.google.com/");
CheckAction(*actions->at(4).get(),
"punky",
Action::ACTION_DOM_ACCESS,
"lets",
"[\"vamoose\"]",
"",
"",
"");
}
static void CheckAction(const Action& action,
......@@ -282,7 +351,7 @@ class FullStreamUIPolicyTest : public testing::Test {
static void NoActionsDeleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(4, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -291,7 +360,7 @@ class FullStreamUIPolicyTest : public testing::Test {
"Google2",
"http://www.args-url2.com/");
ASSERT_EQ(3, actions->at(0)->action_id());
CheckAction(*actions->at(1),
CheckAction(*actions->at(1).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -300,7 +369,7 @@ class FullStreamUIPolicyTest : public testing::Test {
"Google2",
"http://www.args-url2.com/");
ASSERT_EQ(4, actions->at(1)->action_id());
CheckAction(*actions->at(2),
CheckAction(*actions->at(2).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......@@ -309,7 +378,7 @@ class FullStreamUIPolicyTest : public testing::Test {
"Google1",
"http://www.args-url1.com/");
ASSERT_EQ(1, actions->at(2)->action_id());
CheckAction(*actions->at(3),
CheckAction(*actions->at(3).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......@@ -323,7 +392,7 @@ class FullStreamUIPolicyTest : public testing::Test {
static void Action1Deleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -332,7 +401,7 @@ class FullStreamUIPolicyTest : public testing::Test {
"Google2",
"http://www.args-url2.com/");
ASSERT_EQ(3, actions->at(0)->action_id());
CheckAction(*actions->at(1),
CheckAction(*actions->at(1).get(),
"punky2",
Action::ACTION_API_CALL,
"lets2",
......@@ -346,7 +415,7 @@ class FullStreamUIPolicyTest : public testing::Test {
static void Action2Deleted(scoped_ptr<Action::ActionVector> actions) {
// These will be in the vector in reverse time order.
ASSERT_EQ(2, static_cast<int>(actions->size()));
CheckAction(*actions->at(0),
CheckAction(*actions->at(0).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......@@ -355,7 +424,7 @@ class FullStreamUIPolicyTest : public testing::Test {
"Google1",
"http://www.args-url1.com/");
ASSERT_EQ(1, actions->at(0)->action_id());
CheckAction(*actions->at(1),
CheckAction(*actions->at(1).get(),
"punky1",
Action::ACTION_DOM_ACCESS,
"lets1",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment