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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/activity_flags_unittest.cc
diff --git a/gpu/command_buffer/common/activity_flags_unittest.cc b/gpu/command_buffer/common/activity_flags_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3fe930849c78f07e56abe40eab3a145430fd5ddf
--- /dev/null
+++ b/gpu/command_buffer/common/activity_flags_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/command_buffer/common/activity_flags.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gpu {
+
+TEST(ActivityFlagsTest, BasicUsage) {
+ // Create the host activity flags.
+ GpuProcessHostActivityFlags host_flags;
+ EXPECT_FALSE(
+ host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
+
+ // Create the service activity flags from host memory.
+ GpuProcessActivityFlags service_flags(host_flags.CloneHandle());
+
+ // Ensure we can set and re-set flags.
+ {
+ GpuProcessActivityFlags::ScopedSetFlag scoped_set_flag(
+ &service_flags, ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
+ EXPECT_TRUE(
+ host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
+ }
+ EXPECT_FALSE(
+ host_flags.IsFlagSet(ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY));
+}
+
+TEST(ActivityFlagsTest, NotInitialized) {
+ // Get the service activity flags without providing host memory.
+ auto buffer = mojo::ScopedSharedBufferHandle();
+ GpuProcessActivityFlags service_flags(std::move(buffer));
+
+ // Set/Unset should not crash.
+ {
+ GpuProcessActivityFlags::ScopedSetFlag scoped_set_flag(
+ &service_flags, ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
+ }
+}
+
+} // namespace gpu
« 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