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

Unified Diff: chrome/browser/chromeos/gdata/gdata_cache_entry_unittest.cc

Issue 10690149: gdata: Move GDataCache::CacheEntry out of GDataCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removing the existing test Created 8 years, 5 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
Index: chrome/browser/chromeos/gdata/gdata_cache_entry_unittest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_cache_entry_unittest.cc b/chrome/browser/chromeos/gdata/gdata_cache_entry_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ae097ff5e465099b4a22d2b9c669489e0d7c8444
--- /dev/null
+++ b/chrome/browser/chromeos/gdata/gdata_cache_entry_unittest.cc
@@ -0,0 +1,96 @@
+// Copyright (c) 2012 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 "chrome/browser/chromeos/gdata/gdata_cache_entry.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gdata {
+
+TEST(GDataCacheEntryTest, CacheStateChanges) {
+ GDataCacheEntry cache_entry("dummy_md5", CACHE_STATE_NONE);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+
+ cache_entry.SetPresent(true);
+ EXPECT_TRUE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+
+ cache_entry.SetPinned(true);
+ EXPECT_TRUE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+
+ cache_entry.SetDirty(true);
+ EXPECT_TRUE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+
+ cache_entry.SetMounted(true);
+ EXPECT_TRUE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+
+ cache_entry.SetPersistent(true);
+ EXPECT_TRUE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetPresent(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetPresent(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_TRUE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetPinned(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_TRUE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetDirty(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_TRUE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetMounted(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_TRUE(cache_entry.IsPersistent());
+
+ cache_entry.SetPersistent(false);
+ EXPECT_FALSE(cache_entry.IsPresent());
+ EXPECT_FALSE(cache_entry.IsPinned());
+ EXPECT_FALSE(cache_entry.IsDirty());
+ EXPECT_FALSE(cache_entry.IsMounted());
+ EXPECT_FALSE(cache_entry.IsPersistent());
+}
+
+} // namespace gdata

Powered by Google App Engine
This is Rietveld 408576698