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

Side by Side Diff: content/browser/cache_storage/cache_storage_scheduler_unittest.cc

Issue 2168123002: [CacheStorage] Add metrics to the scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/cache_storage/cache_storage_scheduler.h" 5 #include "content/browser/cache_storage/cache_storage_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/public/test/test_browser_thread_bundle.h" 10 #include "content/public/test/test_browser_thread_bundle.h"
(...skipping 17 matching lines...) Expand all
28 CacheStorageScheduler* scheduler_; 28 CacheStorageScheduler* scheduler_;
29 int callback_count_; 29 int callback_count_;
30 }; 30 };
31 31
32 } // namespace 32 } // namespace
33 33
34 class CacheStorageSchedulerTest : public testing::Test { 34 class CacheStorageSchedulerTest : public testing::Test {
35 protected: 35 protected:
36 CacheStorageSchedulerTest() 36 CacheStorageSchedulerTest()
37 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), 37 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
38 scheduler_(CacheStorageSchedulerClient::CLIENT_STORAGE),
38 task1_(TestTask(&scheduler_)), 39 task1_(TestTask(&scheduler_)),
39 task2_(TestTask(&scheduler_)) {} 40 task2_(TestTask(&scheduler_)) {}
40 41
41 TestBrowserThreadBundle browser_thread_bundle_; 42 TestBrowserThreadBundle browser_thread_bundle_;
42 CacheStorageScheduler scheduler_; 43 CacheStorageScheduler scheduler_;
43 TestTask task1_; 44 TestTask task1_;
44 TestTask task2_; 45 TestTask task2_;
45 }; 46 };
46 47
47 TEST_F(CacheStorageSchedulerTest, ScheduleOne) { 48 TEST_F(CacheStorageSchedulerTest, ScheduleOne) {
(...skipping 24 matching lines...) Expand all
72 base::Bind(&TestTask::Run, base::Unretained(&task1_))); 73 base::Bind(&TestTask::Run, base::Unretained(&task1_)));
73 EXPECT_TRUE(scheduler_.ScheduledOperations()); 74 EXPECT_TRUE(scheduler_.ScheduledOperations());
74 base::RunLoop().RunUntilIdle(); 75 base::RunLoop().RunUntilIdle();
75 EXPECT_EQ(1, task1_.callback_count()); 76 EXPECT_EQ(1, task1_.callback_count());
76 EXPECT_TRUE(scheduler_.ScheduledOperations()); 77 EXPECT_TRUE(scheduler_.ScheduledOperations());
77 task1_.Done(); 78 task1_.Done();
78 EXPECT_FALSE(scheduler_.ScheduledOperations()); 79 EXPECT_FALSE(scheduler_.ScheduledOperations());
79 } 80 }
80 81
81 } // namespace content 82 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage_scheduler_client.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698