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

Side by Side Diff: gpu/command_buffer/common/activity_flags_unittest.cc

Issue 2744363002: Clear shader disk cache after glProgramBinary failure. (Closed)
Patch Set: Remove singleton and clean up init Created 3 years, 9 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gpu/command_buffer/common/activity_flags.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace gpu {
10
11 TEST(ActivityFlagsTest, BasicUsage) {
12 // Create the host activity flags.
13 GpuProcessHostActivityFlags host_flags;
14 EXPECT_FALSE(
15 host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
16
17 // Create the service activity flags from host memory.
18 GpuProcessActivityFlags service_flags(host_flags.CloneHandle());
19
20 // Ensure we can set and re-set flags.
21 {
22 GpuProcessActivityFlags::ScopedSetFlag scoped_set_flag(
23 &service_flags, ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
24 EXPECT_TRUE(
25 host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
26 }
27 EXPECT_FALSE(
28 host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
29 }
30
31 TEST(ActivityFlagsTest, NotInitialized) {
32 // Get the service activity flags without providing host memory.
33 auto buffer = mojo::ScopedSharedBufferHandle();
34 GpuProcessActivityFlags service_flags(std::move(buffer));
35
36 // Set/Unset should not crash.
37 {
38 GpuProcessActivityFlags::ScopedSetFlag scoped_set_flag(
39 &service_flags, ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
40 }
41 }
42
43 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/activity_flags.cc ('k') | gpu/command_buffer/service/memory_program_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698