| Index: chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
|
| diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
|
| index e2bf89d1c7a581d7027bee9977ee0a5e6f246779..1188132e4879e30c24344f0e93577d8f00fdaac8 100644
|
| --- a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
|
| +++ b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
|
| @@ -22,12 +22,16 @@ class PermissionBubbleManagerTest : public ChromeRenderViewHostTestHarness {
|
| public:
|
| PermissionBubbleManagerTest()
|
| : ChromeRenderViewHostTestHarness(),
|
| - request1_("test1", PermissionBubbleType::QUOTA),
|
| - request2_("test2", PermissionBubbleType::DOWNLOAD),
|
| + request1_("test1",
|
| + PermissionBubbleType::QUOTA,
|
| + PermissionBubbleGestureType::GESTURE),
|
| + request2_("test2",
|
| + PermissionBubbleType::DOWNLOAD,
|
| + PermissionBubbleGestureType::NO_GESTURE),
|
| iframe_request_same_domain_("iframe",
|
| GURL("http://www.google.com/some/url")),
|
| - iframe_request_other_domain_("iframe",
|
| - GURL("http://www.youtube.com")) {}
|
| + iframe_request_other_domain_("iframe", GURL("http://www.youtube.com")) {
|
| + }
|
| ~PermissionBubbleManagerTest() override {}
|
|
|
| void SetUp() override {
|
| @@ -454,7 +458,7 @@ TEST_F(PermissionBubbleManagerTest, RequestsDontNeedUserGesture) {
|
| EXPECT_TRUE(view_factory_->is_visible());
|
| }
|
|
|
| -TEST_F(PermissionBubbleManagerTest, UMAForSimpleAcceptedBubble) {
|
| +TEST_F(PermissionBubbleManagerTest, UMAForSimpleAcceptedGestureBubble) {
|
| base::HistogramTester histograms;
|
|
|
| manager_->AddRequest(&request1_);
|
| @@ -465,6 +469,12 @@ TEST_F(PermissionBubbleManagerTest, UMAForSimpleAcceptedBubble) {
|
| static_cast<base::HistogramBase::Sample>(PermissionBubbleType::QUOTA),
|
| 1);
|
| histograms.ExpectUniqueSample(
|
| + PermissionUmaUtil::kPermissionsPromptGestureShown,
|
| + static_cast<base::HistogramBase::Sample>(PermissionBubbleType::QUOTA),
|
| + 1);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptNoGestureShown, 0);
|
| + histograms.ExpectUniqueSample(
|
| PermissionUmaUtil::kPermissionsPromptRequestsPerPrompt, 1, 1);
|
|
|
| ToggleAccept(0, true);
|
| @@ -472,21 +482,46 @@ TEST_F(PermissionBubbleManagerTest, UMAForSimpleAcceptedBubble) {
|
| histograms.ExpectUniqueSample(
|
| PermissionUmaUtil::kPermissionsPromptAccepted,
|
| static_cast<base::HistogramBase::Sample>(PermissionBubbleType::QUOTA), 1);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptDenied, 0);
|
| +
|
| + histograms.ExpectUniqueSample(
|
| + PermissionUmaUtil::kPermissionsPromptGestureAccepted,
|
| + static_cast<base::HistogramBase::Sample>(PermissionBubbleType::QUOTA), 1);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptNoGestureAccepted, 0);
|
| }
|
|
|
| -TEST_F(PermissionBubbleManagerTest, UMAForSimpleDeniedBubble) {
|
| +TEST_F(PermissionBubbleManagerTest, UMAForSimpleDeniedNoGestureBubble) {
|
| base::HistogramTester histograms;
|
|
|
| - manager_->AddRequest(&request1_);
|
| + manager_->AddRequest(&request2_);
|
| manager_->DisplayPendingRequests();
|
| WaitForCoalescing();
|
| - // No need to test UMA for showing prompts again, they were tested in
|
| - // UMAForSimpleAcceptedBubble.
|
| +
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptGestureShown, 0);
|
| + histograms.ExpectUniqueSample(
|
| + PermissionUmaUtil::kPermissionsPromptNoGestureShown,
|
| + static_cast<base::HistogramBase::Sample>(PermissionBubbleType::DOWNLOAD),
|
| + 1);
|
| + // No need to test the other UMA for showing prompts again, they were tested
|
| + // in UMAForSimpleAcceptedBubble.
|
|
|
| Deny();
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptAccepted, 0);
|
| histograms.ExpectUniqueSample(
|
| PermissionUmaUtil::kPermissionsPromptDenied,
|
| - static_cast<base::HistogramBase::Sample>(PermissionBubbleType::QUOTA), 1);
|
| + static_cast<base::HistogramBase::Sample>(PermissionBubbleType::DOWNLOAD),
|
| + 1);
|
| +
|
| + histograms.ExpectUniqueSample(
|
| + PermissionUmaUtil::kPermissionsPromptNoGestureDenied,
|
| + static_cast<base::HistogramBase::Sample>(PermissionBubbleType::DOWNLOAD),
|
| + 1);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptGestureDenied, 0);
|
| }
|
|
|
| // This code path (calling Accept on a non-merged bubble, with no accepted
|
| @@ -530,6 +565,10 @@ TEST_F(PermissionBubbleManagerTest, UMAForMergedAcceptedBubble) {
|
| 1);
|
| histograms.ExpectUniqueSample(
|
| PermissionUmaUtil::kPermissionsPromptRequestsPerPrompt, 2, 1);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptGestureShown, 0);
|
| + histograms.ExpectTotalCount(
|
| + PermissionUmaUtil::kPermissionsPromptNoGestureShown, 0);
|
|
|
| ToggleAccept(0, true);
|
| ToggleAccept(1, true);
|
|
|