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

Unified Diff: chrome/browser/extensions/extension_functional_browsertest.cc

Issue 2925193002: NOT YET READY: UMA recording the kind of target frame when extensions pierce browsing instance.
Patch Set: Rebasing... Created 3 years, 6 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 | « base/test/histogram_tester.h ('k') | chrome/browser/extensions/extension_management.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_functional_browsertest.cc
diff --git a/chrome/browser/extensions/extension_functional_browsertest.cc b/chrome/browser/extensions/extension_functional_browsertest.cc
index 9e6b5ba6cd418e91294e17282ff20128af44beba..7833b181f6b8dd15a6e21e18cd83022c3e03551d 100644
--- a/chrome/browser/extensions/extension_functional_browsertest.cc
+++ b/chrome/browser/extensions/extension_functional_browsertest.cc
@@ -4,11 +4,13 @@
#include <stddef.h>
+#include "base/test/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
+#include "chrome/browser/metrics/subprocess_metrics_provider.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -23,6 +25,8 @@
#include "extensions/browser/extension_util.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/test_extension_registry_observer.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -159,6 +163,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest,
// Verify that |tab1_popup| can find unrelated frames from the same extension
// (i.e. that it can find |tab2|.
+ base::HistogramTester histogram_tester;
std::string location_of_opened_window;
EXPECT_TRUE(ExecuteScriptAndExtractString(
tab1_popup,
@@ -166,6 +171,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionFunctionalTest,
"window.domAutomationController.send(w.location.href);",
&location_of_opened_window));
EXPECT_EQ(tab2->GetLastCommittedURL(), location_of_opened_window);
+
+ // Verify UMA got recorded as expected.
+ SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "Extensions.BrowsingInstanceViolation.ExtensionType"),
+ testing::ElementsAre(base::Bucket(Manifest::TYPE_EXTENSION, 1)));
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "Extensions.BrowsingInstanceViolation.ExtensionViewType"),
+ testing::ElementsAre(base::Bucket(VIEW_TYPE_TAB_CONTENTS, 1)));
}
} // namespace extensions
« no previous file with comments | « base/test/histogram_tester.h ('k') | chrome/browser/extensions/extension_management.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698