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

Side by Side Diff: cc/output/context_cache_controller_unittest.cc

Issue 2651703004: Temporarily disable context idle cleanup. (Closed)
Patch Set: Disable unit tests as well Created 3 years, 11 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 | « cc/output/context_cache_controller.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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "cc/output/context_cache_controller.h" 5 #include "cc/output/context_cache_controller.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/test/test_mock_time_task_runner.h" 8 #include "base/test/test_mock_time_task_runner.h"
9 #include "cc/test/test_context_provider.h" 9 #include "cc/test/test_context_provider.h"
10 #include "cc/test/test_context_support.h" 10 #include "cc/test/test_context_support.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 auto visibility_1 = cache_controller.ClientBecameVisible(); 47 auto visibility_1 = cache_controller.ClientBecameVisible();
48 Mock::VerifyAndClearExpectations(&context_support); 48 Mock::VerifyAndClearExpectations(&context_support);
49 auto visibility_2 = cache_controller.ClientBecameVisible(); 49 auto visibility_2 = cache_controller.ClientBecameVisible();
50 50
51 cache_controller.ClientBecameNotVisible(std::move(visibility_1)); 51 cache_controller.ClientBecameNotVisible(std::move(visibility_1));
52 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true)); 52 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true));
53 cache_controller.ClientBecameNotVisible(std::move(visibility_2)); 53 cache_controller.ClientBecameNotVisible(std::move(visibility_2));
54 } 54 }
55 55
56 TEST(ContextCacheControllerTest, ScopedBusyWhileVisible) { 56 TEST(ContextCacheControllerTest, ScopedBusyWhileVisible) {
57 // TODO(ericrk): Temporarily disabling this to investigate whether this
58 // code regressed scroll latency on Android. crbug.com/664181
59 #if defined(OS_ANDROID)
60 return;
61 #endif
57 StrictMock<MockContextSupport> context_support; 62 StrictMock<MockContextSupport> context_support;
58 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner); 63 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner);
59 ContextCacheController cache_controller(&context_support, task_runner); 64 ContextCacheController cache_controller(&context_support, task_runner);
60 65
61 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false)); 66 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false));
62 auto visibility = cache_controller.ClientBecameVisible(); 67 auto visibility = cache_controller.ClientBecameVisible();
63 Mock::VerifyAndClearExpectations(&context_support); 68 Mock::VerifyAndClearExpectations(&context_support);
64 69
65 // Now that we're visible, ensure that going idle triggers a delayed cleanup. 70 // Now that we're visible, ensure that going idle triggers a delayed cleanup.
66 auto busy = cache_controller.ClientBecameBusy(); 71 auto busy = cache_controller.ClientBecameBusy();
67 cache_controller.ClientBecameNotBusy(std::move(busy)); 72 cache_controller.ClientBecameNotBusy(std::move(busy));
68 73
69 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true)); 74 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true));
70 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false)); 75 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false));
71 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5)); 76 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5));
72 Mock::VerifyAndClearExpectations(&context_support); 77 Mock::VerifyAndClearExpectations(&context_support);
73 78
74 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true)); 79 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true));
75 cache_controller.ClientBecameNotVisible(std::move(visibility)); 80 cache_controller.ClientBecameNotVisible(std::move(visibility));
76 } 81 }
77 82
78 TEST(ContextCacheControllerTest, ScopedBusyWhileNotVisible) { 83 TEST(ContextCacheControllerTest, ScopedBusyWhileNotVisible) {
84 // TODO(ericrk): Temporarily disabling this to investigate whether this
85 // code regressed scroll latency on Android. crbug.com/664181
86 #if defined(OS_ANDROID)
87 return;
88 #endif
79 StrictMock<MockContextSupport> context_support; 89 StrictMock<MockContextSupport> context_support;
80 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner); 90 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner);
81 ContextCacheController cache_controller(&context_support, task_runner); 91 ContextCacheController cache_controller(&context_support, task_runner);
82 92
83 auto busy = cache_controller.ClientBecameBusy(); 93 auto busy = cache_controller.ClientBecameBusy();
84 94
85 // We are not visible, so becoming busy should not trigger an idle callback. 95 // We are not visible, so becoming busy should not trigger an idle callback.
86 cache_controller.ClientBecameNotBusy(std::move(busy)); 96 cache_controller.ClientBecameNotBusy(std::move(busy));
87 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5)); 97 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5));
88 } 98 }
89 99
90 TEST(ContextCacheControllerTest, ScopedBusyMulitpleWhileVisible) { 100 TEST(ContextCacheControllerTest, ScopedBusyMulitpleWhileVisible) {
101 // TODO(ericrk): Temporarily disabling this to investigate whether this
102 // code regressed scroll latency on Android. crbug.com/664181
103 #if defined(OS_ANDROID)
104 return;
105 #endif
91 StrictMock<MockContextSupport> context_support; 106 StrictMock<MockContextSupport> context_support;
92 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner); 107 auto task_runner = make_scoped_refptr(new base::TestMockTimeTaskRunner);
93 ContextCacheController cache_controller(&context_support, task_runner); 108 ContextCacheController cache_controller(&context_support, task_runner);
94 109
95 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false)); 110 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false));
96 auto visible = cache_controller.ClientBecameVisible(); 111 auto visible = cache_controller.ClientBecameVisible();
97 Mock::VerifyAndClearExpectations(&context_support); 112 Mock::VerifyAndClearExpectations(&context_support);
98 113
99 auto busy_1 = cache_controller.ClientBecameBusy(); 114 auto busy_1 = cache_controller.ClientBecameBusy();
100 cache_controller.ClientBecameNotBusy(std::move(busy_1)); 115 cache_controller.ClientBecameNotBusy(std::move(busy_1));
101 auto busy_2 = cache_controller.ClientBecameBusy(); 116 auto busy_2 = cache_controller.ClientBecameBusy();
102 cache_controller.ClientBecameNotBusy(std::move(busy_2)); 117 cache_controller.ClientBecameNotBusy(std::move(busy_2));
103 118
104 // When we fast forward, only one cleanup should happen. 119 // When we fast forward, only one cleanup should happen.
105 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true)); 120 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true));
106 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false)); 121 EXPECT_CALL(context_support, SetAggressivelyFreeResources(false));
107 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5)); 122 task_runner->FastForwardBy(base::TimeDelta::FromSeconds(5));
108 Mock::VerifyAndClearExpectations(&context_support); 123 Mock::VerifyAndClearExpectations(&context_support);
109 124
110 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true)); 125 EXPECT_CALL(context_support, SetAggressivelyFreeResources(true));
111 cache_controller.ClientBecameNotVisible(std::move(visible)); 126 cache_controller.ClientBecameNotVisible(std::move(visible));
112 } 127 }
113 128
114 } // namespace 129 } // namespace
115 } // namespace cc 130 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/context_cache_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698