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

Unified Diff: chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc

Issue 2862183002: [MD settings] test UMA when changing site settings exceptions (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index a156676b83198c9e00233335f38ea5105fe7438f..3b869a210f4eb81ea37053c7797b2afe43a2abd6 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -6,6 +6,7 @@
#include <memory>
+#include "base/test/histogram_tester.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/webui/site_settings_helper.h"
#include "chrome/test/base/testing_profile.h"
@@ -260,8 +261,14 @@ TEST_F(SiteSettingsHandlerTest, Origins) {
setArgs.AppendString("notifications");
setArgs.AppendString("block");
setArgs.AppendBoolean(false); // Incognito.
+ base::HistogramTester histograms;
handler()->HandleSetCategoryPermissionForOrigin(&setArgs);
EXPECT_EQ(1U, web_ui()->call_data().size());
+ const std::string kUmaBase("WebsiteSettings.Menu.PermissionChanged");
+ histograms.ExpectTotalCount(kUmaBase, 1);
+ histograms.ExpectTotalCount(kUmaBase + ".Allowed", 0);
+ histograms.ExpectTotalCount(kUmaBase + ".Blocked", 1);
+ histograms.ExpectTotalCount(kUmaBase + ".Reset", 0);
// Verify the change was successful.
base::ListValue listArgs;
@@ -278,6 +285,10 @@ TEST_F(SiteSettingsHandlerTest, Origins) {
resetArgs.AppendBoolean(false); // Incognito.
handler()->HandleResetCategoryPermissionForOrigin(&resetArgs);
EXPECT_EQ(3U, web_ui()->call_data().size());
+ histograms.ExpectTotalCount(kUmaBase, 2); // Including the "block" above.
Dan Beam 2017/05/05 01:40:48 nit: you could just make a new scope { base::Hi
dschuyler 2017/05/05 21:21:35 Done.
+ histograms.ExpectTotalCount(kUmaBase + ".Allowed", 0);
+ histograms.ExpectTotalCount(kUmaBase + ".Blocked", 1);
+ histograms.ExpectTotalCount(kUmaBase + ".Reset", 1);
// Verify the reset was successful.
handler()->HandleGetExceptionList(&listArgs);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698