| 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 "chrome/browser/chromeos/gdata/drive_api_parser.h" | 5 #include "chrome/browser/chromeos/gdata/drive_api_parser.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_test_util.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_test_util.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 using base::Value; | 20 using base::Value; |
| 21 using base::DictionaryValue; | 21 using base::DictionaryValue; |
| 22 using base::ListValue; | 22 using base::ListValue; |
| 23 | 23 |
| 24 namespace gdata { | 24 namespace gdata { |
| 25 | 25 |
| 26 // TODO(nhiroki): Make it possible to run these tests on any platforms after |
| 27 // moving json files to out of 'chromeos' directory (http://crbug.com/149788). |
| 28 #if defined(OS_CHROMEOS) |
| 26 // Test about resource parsing. | 29 // Test about resource parsing. |
| 27 TEST(DriveAPIParserTest, AboutResourceParser) { | 30 TEST(DriveAPIParserTest, AboutResourceParser) { |
| 28 std::string error; | 31 std::string error; |
| 29 scoped_ptr<Value> document = test_util::LoadJSONFile("drive/about.json"); | 32 scoped_ptr<Value> document = test_util::LoadJSONFile("drive/about.json"); |
| 30 ASSERT_TRUE(document.get()); | 33 ASSERT_TRUE(document.get()); |
| 31 | 34 |
| 32 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); | 35 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); |
| 33 scoped_ptr<AboutResource> resource(new AboutResource()); | 36 scoped_ptr<AboutResource> resource(new AboutResource()); |
| 34 EXPECT_TRUE(resource->Parse(*document)); | 37 EXPECT_TRUE(resource->Parse(*document)); |
| 35 | 38 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 const ChangeResource& change2 = *changelist->items()[1]; | 254 const ChangeResource& change2 = *changelist->items()[1]; |
| 252 EXPECT_EQ(8424, change2.change_id()); | 255 EXPECT_EQ(8424, change2.change_id()); |
| 253 EXPECT_FALSE(change2.is_deleted()); | 256 EXPECT_FALSE(change2.is_deleted()); |
| 254 EXPECT_EQ(change2.file_id(), change2.file().file_id()); | 257 EXPECT_EQ(change2.file_id(), change2.file().file_id()); |
| 255 | 258 |
| 256 const ChangeResource& change3 = *changelist->items()[2]; | 259 const ChangeResource& change3 = *changelist->items()[2]; |
| 257 EXPECT_EQ(8429, change3.change_id()); | 260 EXPECT_EQ(8429, change3.change_id()); |
| 258 EXPECT_FALSE(change3.is_deleted()); | 261 EXPECT_FALSE(change3.is_deleted()); |
| 259 EXPECT_EQ(change3.file_id(), change3.file().file_id()); | 262 EXPECT_EQ(change3.file_id(), change3.file().file_id()); |
| 260 } | 263 } |
| 264 #endif // OS_CHROMEOS |
| 261 | 265 |
| 262 } // namespace gdata | 266 } // namespace gdata |
| OLD | NEW |