| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "google_apis/drive/drive_api_parser.h" | 5 #include "google_apis/drive/drive_api_parser.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "google_apis/drive/test_util.h" | 9 #include "google_apis/drive/test_util.h" |
| 10 #include "google_apis/drive/time_util.h" | 10 #include "google_apis/drive/time_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace google_apis { | 13 namespace google_apis { |
| 14 | 14 |
| 15 // Test about resource parsing. | 15 // Test about resource parsing. |
| 16 TEST(DriveAPIParserTest, AboutResourceParser) { | 16 TEST(DriveAPIParserTest, AboutResourceParser) { |
| 17 std::string error; | 17 std::string error; |
| 18 scoped_ptr<base::Value> document = test_util::LoadJSONFile( | 18 scoped_ptr<base::Value> document = test_util::LoadJSONFile( |
| 19 "drive/about.json"); | 19 "drive/about.json"); |
| 20 ASSERT_TRUE(document.get()); | 20 ASSERT_TRUE(document.get()); |
| 21 | 21 |
| 22 ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType()); | 22 ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType()); |
| 23 scoped_ptr<AboutResource> resource(new AboutResource()); | 23 scoped_ptr<AboutResource> resource(new AboutResource()); |
| 24 EXPECT_TRUE(resource->Parse(*document)); | 24 EXPECT_TRUE(resource->Parse(*document)); |
| 25 | 25 |
| 26 EXPECT_EQ("0AIv7G8yEYAWHUk9123", resource->root_folder_id()); | 26 EXPECT_EQ("0AIv7G8yEYAWHUk9123", resource->root_folder_id()); |
| 27 EXPECT_EQ(5368709120LL, resource->quota_bytes_total()); | 27 EXPECT_EQ(5368709120LL, resource->quota_bytes_total()); |
| 28 EXPECT_EQ(1073741824LL, resource->quota_bytes_used()); | 28 EXPECT_EQ(1073741824LL, resource->quota_bytes_used_aggregate()); |
| 29 EXPECT_EQ(8177LL, resource->largest_change_id()); | 29 EXPECT_EQ(8177LL, resource->largest_change_id()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Test app list parsing. | 32 // Test app list parsing. |
| 33 TEST(DriveAPIParserTest, AppListParser) { | 33 TEST(DriveAPIParserTest, AppListParser) { |
| 34 std::string error; | 34 std::string error; |
| 35 scoped_ptr<base::Value> document = test_util::LoadJSONFile( | 35 scoped_ptr<base::Value> document = test_util::LoadJSONFile( |
| 36 "drive/applist.json"); | 36 "drive/applist.json"); |
| 37 ASSERT_TRUE(document.get()); | 37 ASSERT_TRUE(document.get()); |
| 38 | 38 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 test_util::LoadJSONFile("drive/filelist.json")); | 269 test_util::LoadJSONFile("drive/filelist.json")); |
| 270 | 270 |
| 271 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json)); | 271 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json)); |
| 272 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json)); | 272 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json)); |
| 273 | 273 |
| 274 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json)); | 274 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json)); |
| 275 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json)); | 275 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace google_apis | 278 } // namespace google_apis |
| OLD | NEW |