| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/budget_service/budget_database.h" | 5 #include "chrome/browser/budget_service/budget_database.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 10 #include "base/test/histogram_tester.h" | 11 #include "base/test/histogram_tester.h" |
| 11 #include "base/test/simple_test_clock.h" | 12 #include "base/test/simple_test_clock.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/budget_service/budget.pb.h" | 14 #include "chrome/browser/budget_service/budget.pb.h" |
| 14 #include "chrome/browser/engagement/site_engagement_service.h" | 15 #include "chrome/browser/engagement/site_engagement_service.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 16 #include "components/leveldb_proto/proto_database.h" | 17 #include "components/leveldb_proto/proto_database.h" |
| 17 #include "components/leveldb_proto/proto_database_impl.h" | 18 #include "components/leveldb_proto/proto_database_impl.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 307 |
| 307 std::vector<base::Bucket> low_budget_buckets = | 308 std::vector<base::Bucket> low_budget_buckets = |
| 308 GetHistogramTester()->GetAllSamples( | 309 GetHistogramTester()->GetAllSamples( |
| 309 "PushMessaging.SESForLowBudgetOrigin"); | 310 "PushMessaging.SESForLowBudgetOrigin"); |
| 310 ASSERT_EQ(2U, low_budget_buckets.size()); | 311 ASSERT_EQ(2U, low_budget_buckets.size()); |
| 311 EXPECT_EQ(engagement, low_budget_buckets[0].min); | 312 EXPECT_EQ(engagement, low_budget_buckets[0].min); |
| 312 EXPECT_EQ(1, low_budget_buckets[0].count); | 313 EXPECT_EQ(1, low_budget_buckets[0].count); |
| 313 EXPECT_EQ(engagement * 2, low_budget_buckets[1].min); | 314 EXPECT_EQ(engagement * 2, low_budget_buckets[1].min); |
| 314 EXPECT_EQ(1, low_budget_buckets[1].count); | 315 EXPECT_EQ(1, low_budget_buckets[1].count); |
| 315 } | 316 } |
| OLD | NEW |