| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/hash.h" | 10 #include "base/hash.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/test/scoped_task_environment.h" | 16 #include "base/test/scoped_task_environment.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "chromeos/printing/ppd_cache.h" | 18 #include "chromeos/printing/ppd_cache.h" |
| 19 #include "net/url_request/test_url_request_interceptor.h" | 19 #include "net/url_request/test_url_request_interceptor.h" |
| 20 #include "net/url_request/url_request_test_util.h" | 20 #include "net/url_request/url_request_test_util.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 namespace printing { | |
| 25 namespace { | 24 namespace { |
| 26 | 25 |
| 27 // This fixture just points the cache at a temporary directory for the life of | 26 // This fixture just points the cache at a temporary directory for the life of |
| 28 // the test. | 27 // the test. |
| 29 class PpdCacheTest : public ::testing::Test { | 28 class PpdCacheTest : public ::testing::Test { |
| 30 public: | 29 public: |
| 31 PpdCacheTest() | 30 PpdCacheTest() |
| 32 : scoped_task_environment_( | 31 : scoped_task_environment_( |
| 33 base::test::ScopedTaskEnvironment::MainThreadType::IO) {} | 32 base::test::ScopedTaskEnvironment::MainThreadType::IO) {} |
| 34 | 33 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 EXPECT_LT(find_result_.age, base::TimeDelta::FromMinutes(5)); | 106 EXPECT_LT(find_result_.age, base::TimeDelta::FromMinutes(5)); |
| 108 | 107 |
| 109 cache->Find(kTestKey2, base::Bind(&PpdCacheTest::CaptureFindResult, | 108 cache->Find(kTestKey2, base::Bind(&PpdCacheTest::CaptureFindResult, |
| 110 base::Unretained(this))); | 109 base::Unretained(this))); |
| 111 scoped_task_environment_.RunUntilIdle(); | 110 scoped_task_environment_.RunUntilIdle(); |
| 112 EXPECT_EQ(captured_find_results_, 3); | 111 EXPECT_EQ(captured_find_results_, 3); |
| 113 EXPECT_FALSE(find_result_.success); | 112 EXPECT_FALSE(find_result_.success); |
| 114 } | 113 } |
| 115 | 114 |
| 116 } // namespace | 115 } // namespace |
| 117 } // namespace printing | |
| 118 } // namespace chromeos | 116 } // namespace chromeos |
| OLD | NEW |