| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 | 846 |
| 847 EXPECT_NE(kPushMessagingForcedNotificationTag, first_notification.tag()); | 847 EXPECT_NE(kPushMessagingForcedNotificationTag, first_notification.tag()); |
| 848 } | 848 } |
| 849 | 849 |
| 850 // Check that the UMA has been recorded correctly. | 850 // Check that the UMA has been recorded correctly. |
| 851 // There should be a total of 7 budget samples, spread across 3 buckets. The | 851 // There should be a total of 7 budget samples, spread across 3 buckets. The |
| 852 // first four notifications (before any budget is consumed) have budget of 4, | 852 // first four notifications (before any budget is consumed) have budget of 4, |
| 853 // which is the starting SES. The next one has 2 (one hidden notification) and | 853 // which is the starting SES. The next one has 2 (one hidden notification) and |
| 854 // the final two have 0 (two hidden notifications. | 854 // the final two have 0 (two hidden notifications. |
| 855 std::vector<base::Bucket> buckets = | 855 std::vector<base::Bucket> buckets = |
| 856 GetHistogramTester()->GetAllSamples("PushMessaging.BackgroundBudget"); | 856 GetHistogramTester()->GetAllSamples("PushMessaging.BudgetManager"); |
| 857 ASSERT_EQ(3.0, buckets.size()); | 857 ASSERT_EQ(3.0, buckets.size()); |
| 858 // First bucket is for 0 budget, which has 2 samples. | 858 // First bucket is for 0 budget, which has 2 samples. |
| 859 EXPECT_EQ(0, buckets[0].min); | 859 EXPECT_EQ(0, buckets[0].min); |
| 860 EXPECT_EQ(2, buckets[0].count); | 860 EXPECT_EQ(2, buckets[0].count); |
| 861 // Second bucket is for 2 budget, which has 1 sample. | 861 // Second bucket is for 2 budget, which has 1 sample. |
| 862 EXPECT_EQ(2, buckets[1].min); | 862 EXPECT_EQ(2, buckets[1].min); |
| 863 EXPECT_EQ(1, buckets[1].count); | 863 EXPECT_EQ(1, buckets[1].count); |
| 864 // Final bucket is for 4 budget, which has 4 samples. | 864 // Final bucket is for 4 budget, which has 4 samples. |
| 865 EXPECT_EQ(4, buckets[2].min); | 865 EXPECT_EQ(4, buckets[2].min); |
| 866 EXPECT_EQ(4, buckets[2].count); | 866 EXPECT_EQ(4, buckets[2].count); |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1573 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
| 1574 | 1574 |
| 1575 // After dropping the last subscription background mode is still inactive. | 1575 // After dropping the last subscription background mode is still inactive. |
| 1576 std::string script_result; | 1576 std::string script_result; |
| 1577 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); | 1577 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS); |
| 1578 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); | 1578 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result)); |
| 1579 EXPECT_EQ("unsubscribe result: true", script_result); | 1579 EXPECT_EQ("unsubscribe result: true", script_result); |
| 1580 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); | 1580 ASSERT_FALSE(background_mode_manager->IsBackgroundModeActive()); |
| 1581 } | 1581 } |
| 1582 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) | 1582 #endif // BUILDFLAG(ENABLE_BACKGROUND) && !defined(OS_CHROMEOS) |
| OLD | NEW |