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

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

Issue 10384204: gdata: Fix a bug that caused google drive not to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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_files_unittest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_files_unittest.cc b/chrome/browser/chromeos/gdata/gdata_files_unittest.cc
index 9769c69f111fcbeff60258e36b0fefe59af1afe2..35cbc637388d80ab1fe401bca4fe74e840870a41 100644
--- a/chrome/browser/chromeos/gdata/gdata_files_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_files_unittest.cc
@@ -7,6 +7,7 @@
#include <string>
#include <utility>
#include <vector>
+#include "chrome/browser/chromeos/gdata/gdata.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gdata {
@@ -48,4 +49,34 @@ TEST(GDataRootDirectoryTest, RemoveTemporaryFilesFromCacheMap) {
}
+TEST(GDataRootDirectoryTest, ParseFromString_DetectBadTitle) {
+ GDataRootDirectoryProto proto;
+
+ std::string serialized_proto;
+ ASSERT_TRUE(proto.SerializeToString(&serialized_proto));
+
+ GDataRootDirectory root;
+ // This should fail as the title is empty.
+ // root.title() should be unchanged.
+ ASSERT_FALSE(root.ParseFromString(serialized_proto));
+ ASSERT_EQ("drive", root.title());
+
+ // Setting the title to "gdata".
+ proto.mutable_gdata_directory()->mutable_gdata_entry()->set_title("gdata");
+ ASSERT_TRUE(proto.SerializeToString(&serialized_proto));
+
+ // This should fail as the title is not "drive".
+ // root.title() should be unchanged.
+ ASSERT_FALSE(root.ParseFromString(serialized_proto));
+ ASSERT_EQ("drive", root.title());
+
+ // Setting the title to "drive".
+ proto.mutable_gdata_directory()->mutable_gdata_entry()->set_title("drive");
+ ASSERT_TRUE(proto.SerializeToString(&serialized_proto));
+
+ // This should succeed as the title is "drive".
+ ASSERT_TRUE(root.ParseFromString(serialized_proto));
+ ASSERT_EQ("drive", root.title());
+}
+
} // namespace gdata
« chrome/browser/chromeos/gdata/gdata_files.cc ('K') | « chrome/browser/chromeos/gdata/gdata_files.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698