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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_parser_unittest.cc

Issue 11293005: Move chrome/test/data/chromeos/gdata to chrome/test/data/gdata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/google_apis/gdata_wapi_parser.h" 5 #include "chrome/browser/google_apis/gdata_wapi_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/logging.h" 10 #include "base/logging.h"
(...skipping 13 matching lines...) Expand all
24 using base::ListValue; 24 using base::ListValue;
25 25
26 namespace google_apis { 26 namespace google_apis {
27 27
28 class GDataWAPIParserTest : public testing::Test { 28 class GDataWAPIParserTest : public testing::Test {
29 protected: 29 protected:
30 static DocumentEntry* LoadDocumentEntryFromXml(const std::string& filename) { 30 static DocumentEntry* LoadDocumentEntryFromXml(const std::string& filename) {
31 FilePath path; 31 FilePath path;
32 std::string error; 32 std::string error;
33 PathService::Get(chrome::DIR_TEST_DATA, &path); 33 PathService::Get(chrome::DIR_TEST_DATA, &path);
34 path = path.AppendASCII("chromeos") 34 path = path.AppendASCII("gdata").AppendASCII(filename.c_str());
satorux1 2012/11/02 04:07:04 Please use test_util::GetTestFilePath()
tzik 2012/11/02 04:28:30 Done.
35 .AppendASCII("gdata")
36 .AppendASCII(filename.c_str());
37 EXPECT_TRUE(file_util::PathExists(path)) << 35 EXPECT_TRUE(file_util::PathExists(path)) <<
38 "Couldn't find " << path.value(); 36 "Couldn't find " << path.value();
39 std::string contents; 37 std::string contents;
40 EXPECT_TRUE(file_util::ReadFileToString(path, &contents)); 38 EXPECT_TRUE(file_util::ReadFileToString(path, &contents));
41 XmlReader reader; 39 XmlReader reader;
42 if (!reader.Load(contents)) { 40 if (!reader.Load(contents)) {
43 NOTREACHED() << "Invalid xml:\n" << contents; 41 NOTREACHED() << "Invalid xml:\n" << contents;
44 return NULL; 42 return NULL;
45 } 43 }
46 scoped_ptr<DocumentEntry> entry; 44 scoped_ptr<DocumentEntry> entry;
47 while (reader.Read()) { 45 while (reader.Read()) {
48 if (reader.NodeName() == "entry") { 46 if (reader.NodeName() == "entry") {
49 entry.reset(DocumentEntry::CreateFromXml(&reader)); 47 entry.reset(DocumentEntry::CreateFromXml(&reader));
50 break; 48 break;
51 } 49 }
52 } 50 }
53 return entry.release(); 51 return entry.release();
54 } 52 }
55 }; 53 };
56 54
57 // TODO(nhiroki): Make it possible to run these tests on any platforms after
58 // moving json files to out of 'chromeos' directory (http://crbug.com/149788).
59 #if defined(OS_CHROMEOS)
60 // Test document feed parsing. 55 // Test document feed parsing.
61 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { 56 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
62 std::string error; 57 std::string error;
63 scoped_ptr<Value> document = 58 scoped_ptr<Value> document =
64 test_util::LoadJSONFile("gdata/basic_feed.json"); 59 test_util::LoadJSONFile("gdata/basic_feed.json");
65 ASSERT_TRUE(document.get()); 60 ASSERT_TRUE(document.get());
66 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); 61 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType());
67 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document)); 62 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document));
68 ASSERT_TRUE(feed.get()); 63 ASSERT_TRUE(feed.get());
69 64
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name())); 324 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name()));
330 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type())); 325 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type()));
331 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef", 326 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef",
332 second_app->GetProductUrl().spec()); 327 second_app->GetProductUrl().spec());
333 EXPECT_FALSE(second_app->supports_create()); 328 EXPECT_FALSE(second_app->supports_create());
334 EXPECT_EQ(2U, second_app->primary_mimetypes().size()); 329 EXPECT_EQ(2U, second_app->primary_mimetypes().size());
335 EXPECT_EQ(0U, second_app->secondary_mimetypes().size()); 330 EXPECT_EQ(0U, second_app->secondary_mimetypes().size());
336 EXPECT_EQ(1U, second_app->primary_extensions().size()); 331 EXPECT_EQ(1U, second_app->primary_extensions().size());
337 EXPECT_EQ(0U, second_app->secondary_extensions().size()); 332 EXPECT_EQ(0U, second_app->secondary_extensions().size());
338 } 333 }
339 #endif // OS_CHROMEOS
340 334
341 // Test file extension checking in DocumentEntry::HasDocumentExtension(). 335 // Test file extension checking in DocumentEntry::HasDocumentExtension().
342 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) { 336 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) {
343 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 337 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
344 FilePath(FILE_PATH_LITERAL("Test.gdoc")))); 338 FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
345 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 339 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
346 FilePath(FILE_PATH_LITERAL("Test.gsheet")))); 340 FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
347 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 341 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
348 FilePath(FILE_PATH_LITERAL("Test.gslides")))); 342 FilePath(FILE_PATH_LITERAL("Test.gslides"))));
349 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 343 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP)); 381 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
388 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER, 382 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER,
389 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER)); 383 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
390 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 384 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
391 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE)); 385 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
392 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 386 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
393 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF)); 387 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
394 } 388 }
395 389
396 } // namespace google_apis 390 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_test_util.cc ('k') | chrome/browser/google_apis/gdata_wapi_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698