| Index: gpu/ipc/host/shader_disk_cache_unittest.cc
|
| diff --git a/gpu/ipc/host/shader_disk_cache_unittest.cc b/gpu/ipc/host/shader_disk_cache_unittest.cc
|
| deleted file mode 100644
|
| index eae38ade61903559e0efe146e1fcc6f4ad921c55..0000000000000000000000000000000000000000
|
| --- a/gpu/ipc/host/shader_disk_cache_unittest.cc
|
| +++ /dev/null
|
| @@ -1,83 +0,0 @@
|
| -// Copyright 2013 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 "base/files/scoped_temp_dir.h"
|
| -#include "base/macros.h"
|
| -#include "base/message_loop/message_loop.h"
|
| -#include "base/threading/thread.h"
|
| -#include "base/threading/thread_task_runner_handle.h"
|
| -#include "gpu/ipc/host/shader_disk_cache.h"
|
| -#include "net/base/test_completion_callback.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| -
|
| -namespace gpu {
|
| -namespace {
|
| -
|
| -const int kDefaultClientId = 42;
|
| -const char kCacheKey[] = "key";
|
| -const char kCacheValue[] = "cached value";
|
| -
|
| -} // namespace
|
| -
|
| -class ShaderDiskCacheTest : public testing::Test {
|
| - public:
|
| - ShaderDiskCacheTest()
|
| - : cache_thread_("CacheThread") {
|
| - base::Thread::Options options;
|
| - options.message_loop_type = base::MessageLoop::TYPE_IO;
|
| - CHECK(cache_thread_.StartWithOptions(options));
|
| - ShaderCacheFactory::InitInstance(
|
| - base::ThreadTaskRunnerHandle::Get(),
|
| - cache_thread_.task_runner());
|
| - }
|
| -
|
| - ~ShaderDiskCacheTest() override {}
|
| -
|
| - const base::FilePath& cache_path() { return temp_dir_.GetPath(); }
|
| -
|
| - void InitCache() {
|
| - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| - ShaderCacheFactory::GetInstance()->SetCacheInfo(kDefaultClientId,
|
| - cache_path());
|
| - }
|
| -
|
| - private:
|
| - void TearDown() override {
|
| - ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId);
|
| - }
|
| -
|
| - base::ScopedTempDir temp_dir_;
|
| - base::Thread cache_thread_;
|
| - base::MessageLoopForIO message_loop_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ShaderDiskCacheTest);
|
| -};
|
| -
|
| -TEST_F(ShaderDiskCacheTest, ClearsCache) {
|
| - InitCache();
|
| -
|
| - scoped_refptr<ShaderDiskCache> cache =
|
| - ShaderCacheFactory::GetInstance()->Get(kDefaultClientId);
|
| - ASSERT_TRUE(cache.get() != NULL);
|
| -
|
| - net::TestCompletionCallback available_cb;
|
| - int rv = cache->SetAvailableCallback(available_cb.callback());
|
| - ASSERT_EQ(net::OK, available_cb.GetResult(rv));
|
| - EXPECT_EQ(0, cache->Size());
|
| -
|
| - cache->Cache(kCacheKey, kCacheValue);
|
| -
|
| - net::TestCompletionCallback complete_cb;
|
| - rv = cache->SetCacheCompleteCallback(complete_cb.callback());
|
| - ASSERT_EQ(net::OK, complete_cb.GetResult(rv));
|
| - EXPECT_EQ(1, cache->Size());
|
| -
|
| - base::Time time;
|
| - net::TestCompletionCallback clear_cb;
|
| - rv = cache->Clear(time, time, clear_cb.callback());
|
| - ASSERT_EQ(net::OK, clear_cb.GetResult(rv));
|
| - EXPECT_EQ(0, cache->Size());
|
| -};
|
| -
|
| -} // namespace gpu
|
|
|