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

Side by Side Diff: components/offline_pages/offline_page_storage_manager_unittest.cc

Issue 2022283003: Record offline histograms with suffix via Histogram::FactoryGet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « components/offline_pages/offline_page_model_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/offline_pages/offline_page_storage_manager.h" 5 #include "components/offline_pages/offline_page_storage_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/test/simple_test_clock.h" 13 #include "base/test/simple_test_clock.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "components/offline_pages/archive_manager.h" 15 #include "components/offline_pages/archive_manager.h"
16 #include "components/offline_pages/client_namespace_constants.h"
16 #include "components/offline_pages/client_policy_controller.h" 17 #include "components/offline_pages/client_policy_controller.h"
17 #include "components/offline_pages/offline_page_item.h" 18 #include "components/offline_pages/offline_page_item.h"
18 #include "components/offline_pages/offline_page_storage_manager.h" 19 #include "components/offline_pages/offline_page_storage_manager.h"
19 #include "components/offline_pages/offline_page_types.h" 20 #include "components/offline_pages/offline_page_types.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 using LifetimePolicy = offline_pages::LifetimePolicy; 23 using LifetimePolicy = offline_pages::LifetimePolicy;
23 using ClearStorageResult = 24 using ClearStorageResult =
24 offline_pages::OfflinePageStorageManager::ClearStorageResult; 25 offline_pages::OfflinePageStorageManager::ClearStorageResult;
25 using StorageStats = offline_pages::ArchiveManager::StorageStats; 26 using StorageStats = offline_pages::ArchiveManager::StorageStats;
26 27
27 namespace offline_pages { 28 namespace offline_pages {
28 29
29 namespace { 30 namespace {
30 const char kBookmarkNamespace[] = "bookmark";
31 const char kLastNNamespace[] = "last_n";
32 const GURL kTestUrl("http://example.com"); 31 const GURL kTestUrl("http://example.com");
33 const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("/data"); 32 const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("/data");
34 const int64_t kTestFileSize = 500 * (1 << 10); 33 const int64_t kTestFileSize = 500 * (1 << 10);
35 const int64_t kFreeSpaceNormal = 100 * (1 << 20); 34 const int64_t kFreeSpaceNormal = 100 * (1 << 20);
36 35
37 enum TestOptions { 36 enum TestOptions {
38 DEFAULT = 1 << 0, 37 DEFAULT = 1 << 0,
39 EXPIRE_FAILURE = 1 << 1, 38 EXPIRE_FAILURE = 1 << 1,
40 DELETE_FAILURE = 1 << 2, 39 DELETE_FAILURE = 1 << 2,
41 EXPIRE_AND_DELETE_FAILURES = EXPIRE_FAILURE | DELETE_FAILURE, 40 EXPIRE_AND_DELETE_FAILURES = EXPIRE_FAILURE | DELETE_FAILURE,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 EXPECT_EQ(0, client()->GetTotalSize()); 432 EXPECT_EQ(0, client()->GetTotalSize());
434 EXPECT_EQ(5, total_cleared_times()); 433 EXPECT_EQ(5, total_cleared_times());
435 EXPECT_EQ(ClearStorageResult::SUCCESS, last_clear_storage_result()); 434 EXPECT_EQ(ClearStorageResult::SUCCESS, last_clear_storage_result());
436 // Number of removed pages should be the ones expired above and all the pages 435 // Number of removed pages should be the ones expired above and all the pages
437 // initially created for last_n namespace. 436 // initially created for last_n namespace.
438 EXPECT_EQ(expired_page_count + 101, 437 EXPECT_EQ(expired_page_count + 101,
439 static_cast<int>(client()->GetRemovedPages().size())); 438 static_cast<int>(client()->GetRemovedPages().size()));
440 } 439 }
441 440
442 } // namespace offline_pages 441 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698