| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" | 15 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" |
| 14 #include "chrome/browser/extensions/updater/chromeos_extension_cache_delegate.h" | 16 #include "chrome/browser/extensions/updater/chromeos_extension_cache_delegate.h" |
| 15 #include "chrome/browser/extensions/updater/extension_cache_impl.h" | 17 #include "chrome/browser/extensions/updater/extension_cache_impl.h" |
| 16 #include "chrome/browser/extensions/updater/local_extension_cache.h" | 18 #include "chrome/browser/extensions/updater/local_extension_cache.h" |
| 17 #include "chromeos/settings/cros_settings_names.h" | 19 #include "chromeos/settings/cros_settings_names.h" |
| 18 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 22 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 CreateExtensionFile(cache_path, kTestExtensionId1, "1.0", kExtensionSize1, | 79 CreateExtensionFile(cache_path, kTestExtensionId1, "1.0", kExtensionSize1, |
| 78 now - base::TimeDelta::FromSeconds(1)); | 80 now - base::TimeDelta::FromSeconds(1)); |
| 79 const base::FilePath file2 = | 81 const base::FilePath file2 = |
| 80 CreateExtensionFile(cache_path, kTestExtensionId2, "2.0", kExtensionSize2, | 82 CreateExtensionFile(cache_path, kTestExtensionId2, "2.0", kExtensionSize2, |
| 81 now - base::TimeDelta::FromSeconds(2)); | 83 now - base::TimeDelta::FromSeconds(2)); |
| 82 const base::FilePath file3 = | 84 const base::FilePath file3 = |
| 83 CreateExtensionFile(cache_path, kTestExtensionId3, "3.0", kExtensionSize3, | 85 CreateExtensionFile(cache_path, kTestExtensionId3, "3.0", kExtensionSize3, |
| 84 now - base::TimeDelta::FromSeconds(3)); | 86 now - base::TimeDelta::FromSeconds(3)); |
| 85 | 87 |
| 86 ExtensionCacheImpl cache_impl( | 88 ExtensionCacheImpl cache_impl( |
| 87 make_scoped_ptr(new ChromeOSExtensionCacheDelegate(cache_path))); | 89 base::WrapUnique(new ChromeOSExtensionCacheDelegate(cache_path))); |
| 88 | 90 |
| 89 scoped_ptr<base::RunLoop> run_loop(new base::RunLoop); | 91 std::unique_ptr<base::RunLoop> run_loop(new base::RunLoop); |
| 90 cache_impl.Start(run_loop->QuitClosure()); | 92 cache_impl.Start(run_loop->QuitClosure()); |
| 91 run_loop->Run(); | 93 run_loop->Run(); |
| 92 | 94 |
| 93 run_loop.reset(new base::RunLoop); | 95 run_loop.reset(new base::RunLoop); |
| 94 cache_impl.Shutdown(run_loop->QuitClosure()); | 96 cache_impl.Shutdown(run_loop->QuitClosure()); |
| 95 run_loop->Run(); | 97 run_loop->Run(); |
| 96 | 98 |
| 97 EXPECT_TRUE(base::PathExists(file1)); | 99 EXPECT_TRUE(base::PathExists(file1)); |
| 98 EXPECT_TRUE(base::PathExists(file2)); | 100 EXPECT_TRUE(base::PathExists(file2)); |
| 99 EXPECT_FALSE(base::PathExists(file3)); | 101 EXPECT_FALSE(base::PathExists(file3)); |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace extensions | 104 } // namespace extensions |
| OLD | NEW |