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

Unified Diff: chrome/browser/extensions/activity_log/fullstream_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/fullstream_ui_policy_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
index af735b9e8790552ac952c7419197f63309b531a2..860a6b9be8f540660e90eee629d4731fcd205518 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
@@ -68,7 +68,7 @@ class FullStreamUIPolicyTest : public testing::Test {
scoped_refptr<Action> last = i->front();
std::string args =
"ID=odlameecjipmbmbejkplpemijjgpljce CATEGORY=api_call "
- "API=extension.connect ARGS=[\"hello\",\"world\"] OTHER={}";
+ "API=extension.connect ARGS=[\"hello\",\"world\"]";
ASSERT_EQ(args, last->PrintForDebug());
}
@@ -100,8 +100,12 @@ TEST_F(FullStreamUIPolicyTest, 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(FullStreamUIPolicyTest, 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(FullStreamUIPolicyTest::RetrieveActions_LogAndFetchActions));
@@ -140,11 +153,17 @@ TEST_F(FullStreamUIPolicyTest, LogWithArguments) {
.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("extension.connect"), GURL(), args.get(), NULL);
+ scoped_refptr<Action> action = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ "extension.connect");
+ action->set_args(args.Pass());
+
+ policy->ProcessAction(action);
policy->ReadData(extension->id(), 0,
base::Bind(FullStreamUIPolicyTest::Arguments_Present));
policy->Close();

Powered by Google App Engine
This is Rietveld 408576698