OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/gdata/gdata_cache_entry.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 |
| 8 namespace gdata { |
| 9 |
| 10 TEST(GDataCacheEntryTest, CacheStateChanges) { |
| 11 GDataCacheEntry cache_entry("dummy_md5", CACHE_STATE_NONE); |
| 12 EXPECT_FALSE(cache_entry.IsPresent()); |
| 13 EXPECT_FALSE(cache_entry.IsPinned()); |
| 14 EXPECT_FALSE(cache_entry.IsDirty()); |
| 15 EXPECT_FALSE(cache_entry.IsMounted()); |
| 16 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 17 |
| 18 cache_entry.SetPresent(true); |
| 19 EXPECT_TRUE(cache_entry.IsPresent()); |
| 20 EXPECT_FALSE(cache_entry.IsPinned()); |
| 21 EXPECT_FALSE(cache_entry.IsDirty()); |
| 22 EXPECT_FALSE(cache_entry.IsMounted()); |
| 23 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 24 |
| 25 cache_entry.SetPinned(true); |
| 26 EXPECT_TRUE(cache_entry.IsPresent()); |
| 27 EXPECT_TRUE(cache_entry.IsPinned()); |
| 28 EXPECT_FALSE(cache_entry.IsDirty()); |
| 29 EXPECT_FALSE(cache_entry.IsMounted()); |
| 30 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 31 |
| 32 cache_entry.SetDirty(true); |
| 33 EXPECT_TRUE(cache_entry.IsPresent()); |
| 34 EXPECT_TRUE(cache_entry.IsPinned()); |
| 35 EXPECT_TRUE(cache_entry.IsDirty()); |
| 36 EXPECT_FALSE(cache_entry.IsMounted()); |
| 37 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 38 |
| 39 cache_entry.SetMounted(true); |
| 40 EXPECT_TRUE(cache_entry.IsPresent()); |
| 41 EXPECT_TRUE(cache_entry.IsPinned()); |
| 42 EXPECT_TRUE(cache_entry.IsDirty()); |
| 43 EXPECT_TRUE(cache_entry.IsMounted()); |
| 44 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 45 |
| 46 cache_entry.SetPersistent(true); |
| 47 EXPECT_TRUE(cache_entry.IsPresent()); |
| 48 EXPECT_TRUE(cache_entry.IsPinned()); |
| 49 EXPECT_TRUE(cache_entry.IsDirty()); |
| 50 EXPECT_TRUE(cache_entry.IsMounted()); |
| 51 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 52 |
| 53 cache_entry.SetPresent(false); |
| 54 EXPECT_FALSE(cache_entry.IsPresent()); |
| 55 EXPECT_TRUE(cache_entry.IsPinned()); |
| 56 EXPECT_TRUE(cache_entry.IsDirty()); |
| 57 EXPECT_TRUE(cache_entry.IsMounted()); |
| 58 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 59 |
| 60 cache_entry.SetPresent(false); |
| 61 EXPECT_FALSE(cache_entry.IsPresent()); |
| 62 EXPECT_TRUE(cache_entry.IsPinned()); |
| 63 EXPECT_TRUE(cache_entry.IsDirty()); |
| 64 EXPECT_TRUE(cache_entry.IsMounted()); |
| 65 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 66 |
| 67 cache_entry.SetPinned(false); |
| 68 EXPECT_FALSE(cache_entry.IsPresent()); |
| 69 EXPECT_FALSE(cache_entry.IsPinned()); |
| 70 EXPECT_TRUE(cache_entry.IsDirty()); |
| 71 EXPECT_TRUE(cache_entry.IsMounted()); |
| 72 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 73 |
| 74 cache_entry.SetDirty(false); |
| 75 EXPECT_FALSE(cache_entry.IsPresent()); |
| 76 EXPECT_FALSE(cache_entry.IsPinned()); |
| 77 EXPECT_FALSE(cache_entry.IsDirty()); |
| 78 EXPECT_TRUE(cache_entry.IsMounted()); |
| 79 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 80 |
| 81 cache_entry.SetMounted(false); |
| 82 EXPECT_FALSE(cache_entry.IsPresent()); |
| 83 EXPECT_FALSE(cache_entry.IsPinned()); |
| 84 EXPECT_FALSE(cache_entry.IsDirty()); |
| 85 EXPECT_FALSE(cache_entry.IsMounted()); |
| 86 EXPECT_TRUE(cache_entry.IsPersistent()); |
| 87 |
| 88 cache_entry.SetPersistent(false); |
| 89 EXPECT_FALSE(cache_entry.IsPresent()); |
| 90 EXPECT_FALSE(cache_entry.IsPinned()); |
| 91 EXPECT_FALSE(cache_entry.IsDirty()); |
| 92 EXPECT_FALSE(cache_entry.IsMounted()); |
| 93 EXPECT_FALSE(cache_entry.IsPersistent()); |
| 94 } |
| 95 |
| 96 } // namespace gdata |
OLD | NEW |