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

Unified Diff: chrome/browser/extensions/activity_log/stream_noargs_ui_policy_unittest.cc

Issue 19690003: Extension activity log database refactoring (step 3) (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor2
Patch Set: Do not set bad BlockedChromeActivityDetail::Reason values Created 7 years, 5 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/extensions/activity_log/stream_noargs_ui_policy_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/stream_noargs_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/stream_noargs_ui_policy_unittest.cc
index 1a5dd4a5d5d451ec53ce15d32e96500138911508..5c5207add75bc16ccf6ed2f7802c5eab8ff061e2 100644
--- a/chrome/browser/extensions/activity_log/stream_noargs_ui_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/stream_noargs_ui_policy_unittest.cc
@@ -68,7 +68,7 @@ class StreamWithoutArgsUIPolicyTest : public testing::Test {
scoped_refptr<Action> last = i->front();
std::string noargs =
"ID=odlameecjipmbmbejkplpemijjgpljce CATEGORY=api_call "
- "API=tabs.testMethod ARGS=[] OTHER={}";
+ "API=tabs.testMethod";
ASSERT_EQ(noargs, last->PrintForDebug());
}
@@ -100,8 +100,12 @@ TEST_F(StreamWithoutArgsUIPolicyTest, Construct) {
.Build();
extension_service_->AddExtension(extension.get());
scoped_ptr<base::ListValue> args(new base::ListValue());
- policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
- std::string("tabs.testMethod"), GURL(), args.get(), NULL);
+ scoped_refptr<Action> action = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ "tabs.testMethod");
+ action->set_args(args.Pass());
+ policy->ProcessAction(action);
policy->Close();
}
@@ -115,15 +119,24 @@ TEST_F(StreamWithoutArgsUIPolicyTest, LogAndFetchActions) {
.Set("manifest_version", 2))
.Build();
extension_service_->AddExtension(extension.get());
- scoped_ptr<base::ListValue> args(new base::ListValue());
GURL gurl("http://www.google.com");
// Write some API calls
- policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
- std::string("tabs.testMethod"), GURL(), args.get(), NULL);
- policy->ProcessAction(ActivityLogPolicy::ACTION_DOM,
- extension->id(), std::string("document.write"),
- gurl, args.get(), NULL);
+ scoped_refptr<Action> action_api = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ "tabs.testMethod");
+ action_api->set_args(make_scoped_ptr(new base::ListValue()));
+ policy->ProcessAction(action_api);
+
+ scoped_refptr<Action> action_dom = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_DOM_ACCESS,
+ "document.write");
+ action_dom->set_args(make_scoped_ptr(new base::ListValue()));
+ action_dom->set_page_url(gurl);
+ policy->ProcessAction(action_dom);
+
policy->ReadData(extension->id(), 0,
base::Bind(
StreamWithoutArgsUIPolicyTest::RetrieveActions_LogAndFetchActions));
@@ -141,11 +154,17 @@ TEST_F(StreamWithoutArgsUIPolicyTest, LogWithoutArguments) {
.Set("manifest_version", 2))
.Build();
extension_service_->AddExtension(extension.get());
+
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Set(0, new base::StringValue("hello"));
args->Set(1, new base::StringValue("world"));
- policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
- std::string("tabs.testMethod"), GURL(), args.get(), NULL);
+ scoped_refptr<Action> action = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ "tabs.testMethod");
+ action->set_args(args.Pass());
+
+ policy->ProcessAction(action);
policy->ReadData(extension->id(), 0,
base::Bind(StreamWithoutArgsUIPolicyTest::Arguments_Missing));
policy->Close();

Powered by Google App Engine
This is Rietveld 408576698