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 |