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

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

Issue 384983003: Enabling AdInjectionBrowserTest after Activity Log refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 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/ad_injection_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/ad_injection_unittest.cc b/chrome/browser/extensions/activity_log/ad_injection_unittest.cc
index 94dad2af8b00988e89135d26822e01857b888c5a..be2e6c4ad5e62e4afd30d4e7852fb5acc88f303c 100644
--- a/chrome/browser/extensions/activity_log/ad_injection_unittest.cc
+++ b/chrome/browser/extensions/activity_log/ad_injection_unittest.cc
@@ -7,18 +7,26 @@
#include "components/rappor/byte_vector_utils.h"
#include "components/rappor/proto/rappor_metric.pb.h"
#include "components/rappor/rappor_service.h"
+#include "extensions/common/value_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace {
-scoped_refptr<Action> CreateAction(const std::string& api_name) {
+scoped_refptr<Action> CreateAction(const std::string& api_name,
+ const std::string& element,
+ const std::string& attr) {
scoped_refptr<Action> action = new Action("id",
base::Time::Now(),
Action::ACTION_DOM_ACCESS,
api_name);
- action->set_arg_url(GURL("http://www.notarealhost.notarealtld"));
+ action->set_args(ListBuilder()
+ .Append(element)
+ .Append(attr)
+ .Append("http://www.google.co.uk")
+ .Append("http://www.google.co.uk")
+ .Build());
return action;
}
@@ -58,24 +66,19 @@ TEST(AdInjectionUnittest, CheckActionForAdInjectionTest) {
EXPECT_EQ(0, reports.report_size());
scoped_refptr<Action> modify_iframe_src =
- CreateAction("HTMLIFrameElement.src");
+ CreateAction("blinkSetAttribute", "iframe", "src");
modify_iframe_src->DidInjectAd(&rappor_service);
reports = rappor_service.GetReports();
EXPECT_EQ(1, reports.report_size());
- scoped_refptr<Action> modify_embed_src =
- CreateAction("HTMLEmbedElement.src");
- modify_embed_src->DidInjectAd(&rappor_service);
- reports = rappor_service.GetReports();
- EXPECT_EQ(1, reports.report_size());
-
scoped_refptr<Action> modify_anchor_href =
- CreateAction("HTMLAnchorElement.href");
+ CreateAction("blinkSetAttribute", "a", "href");
modify_anchor_href->DidInjectAd(&rappor_service);
reports = rappor_service.GetReports();
EXPECT_EQ(1, reports.report_size());
- scoped_refptr<Action> harmless_action = CreateAction("Location.replace");
+ scoped_refptr<Action> harmless_action =
+ CreateAction("Location.replace", "", "");
harmless_action->DidInjectAd(&rappor_service);
reports = rappor_service.GetReports();
EXPECT_EQ(0, reports.report_size());

Powered by Google App Engine
This is Rietveld 408576698