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

Unified Diff: chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc

Issue 1721633002: Added UMA collection for fullscreen / mouse lock bubble re-shows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved histogram recording into each subclass. (Fix DCHECK / incorrect histogram recording.) Created 4 years, 10 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/ui/exclusive_access/fullscreen_controller_state_unittest.cc
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc
index 9bd0d34ede37a9019e858f2abdc4fbb30c5a845a..21bd59b9c385eb44602372f5fc19758379cad1c4 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc
@@ -3,10 +3,12 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/test/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
+#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -20,6 +22,10 @@
// the FullscreenController through all permutations of events. The behavior
// of the BrowserWindow is mocked via FullscreenControllerTestWindow.
+namespace {
+
+const char kFullscreenReshowHistogramName[] =
+ "ExclusiveAccess.BubbleReshowsPerSession.Fullscreen";
// FullscreenControllerTestWindow ----------------------------------------------
@@ -246,6 +252,8 @@ void FullscreenControllerTestWindow::UpdateExclusiveAccessExitBubbleContent(
void FullscreenControllerTestWindow::OnExclusiveAccessUserInput() {}
+} // namespace
+
// FullscreenControllerStateUnitTest -------------------------------------------
// Unit test fixture testing Fullscreen Controller through its states. Most of
@@ -474,15 +482,25 @@ TEST_F(FullscreenControllerStateUnitTest,
// Test that switching tabs takes the browser out of tab fullscreen.
TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) {
+ base::HistogramTester histogram_tester;
+
AddTab(browser(), GURL(url::kAboutBlankURL));
AddTab(browser(), GURL(url::kAboutBlankURL));
ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
ASSERT_TRUE(browser()->window()->IsFullscreen());
+ histogram_tester.ExpectTotalCount(kFullscreenReshowHistogramName, 0);
browser()->tab_strip_model()->SelectNextTab();
ChangeWindowFullscreenState();
EXPECT_FALSE(browser()->window()->IsFullscreen());
+
+ // Do a simple test that histograms are being recorded upon exiting the
+ // fullscreen session (when simplified-fullscreen-ui is enabled).
+ if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled())
+ histogram_tester.ExpectUniqueSample(kFullscreenReshowHistogramName, 0, 1);
+ else
+ histogram_tester.ExpectTotalCount(kFullscreenReshowHistogramName, 0);
}
// Test that switching tabs via detaching the active tab (which is in tab

Powered by Google App Engine
This is Rietveld 408576698