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

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

Issue 10920091: Move Drive API files to google_apis directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable some tests Created 8 years, 3 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 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/chromeos/gdata/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/path_service.h" 11 #include "base/path_service.h"
11 #include "base/string16.h" 12 #include "base/string16.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/chromeos/gdata/gdata_test_util.h" 16 #include "chrome/browser/google_apis/gdata_test_util.h"
16 #include "chrome/browser/chromeos/gdata/gdata_util.h" 17 #include "chrome/browser/google_apis/gdata_util.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/libxml/chromium/libxml_utils.h" 20 #include "third_party/libxml/chromium/libxml_utils.h"
20 21
21 using base::Value; 22 using base::Value;
22 using base::DictionaryValue; 23 using base::DictionaryValue;
23 using base::ListValue; 24 using base::ListValue;
24 25
25 namespace gdata { 26 namespace gdata {
26 27
(...skipping 19 matching lines...) Expand all
46 while (reader.Read()) { 47 while (reader.Read()) {
47 if (reader.NodeName() == "entry") { 48 if (reader.NodeName() == "entry") {
48 entry.reset(DocumentEntry::CreateFromXml(&reader)); 49 entry.reset(DocumentEntry::CreateFromXml(&reader));
49 break; 50 break;
50 } 51 }
51 } 52 }
52 return entry.release(); 53 return entry.release();
53 } 54 }
54 }; 55 };
55 56
57 // TODO(satorux): Make it possible to run these tests on any platforms after
satorux1 2012/09/15 05:02:22 TODO(nhiroki)
satorux1 2012/09/15 05:18:59 ditto. please do this in a separate patch.
nhiroki 2012/09/15 07:21:39 I made a separate CL (http://codereview.chromium.o
58 // moving json files to out of 'chromeos' directory (http://crbug.com/149788).
59 #if defined(OS_CHROMEOS)
56 // Test document feed parsing. 60 // Test document feed parsing.
57 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { 61 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
58 std::string error; 62 std::string error;
59 scoped_ptr<Value> document = 63 scoped_ptr<Value> document =
60 test_util::LoadJSONFile("gdata/basic_feed.json"); 64 test_util::LoadJSONFile("gdata/basic_feed.json");
61 ASSERT_TRUE(document.get()); 65 ASSERT_TRUE(document.get());
62 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); 66 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType());
63 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document)); 67 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document));
64 ASSERT_TRUE(feed.get()); 68 ASSERT_TRUE(feed.get());
65 69
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name())); 329 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name()));
326 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type())); 330 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type()));
327 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef", 331 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef",
328 second_app->GetProductUrl().spec()); 332 second_app->GetProductUrl().spec());
329 EXPECT_FALSE(second_app->supports_create()); 333 EXPECT_FALSE(second_app->supports_create());
330 EXPECT_EQ(2U, second_app->primary_mimetypes().size()); 334 EXPECT_EQ(2U, second_app->primary_mimetypes().size());
331 EXPECT_EQ(0U, second_app->secondary_mimetypes().size()); 335 EXPECT_EQ(0U, second_app->secondary_mimetypes().size());
332 EXPECT_EQ(1U, second_app->primary_extensions().size()); 336 EXPECT_EQ(1U, second_app->primary_extensions().size());
333 EXPECT_EQ(0U, second_app->secondary_extensions().size()); 337 EXPECT_EQ(0U, second_app->secondary_extensions().size());
334 } 338 }
339 #endif // OS_CHROMEOS
335 340
336 // Test file extension checking in DocumentEntry::HasDocumentExtension(). 341 // Test file extension checking in DocumentEntry::HasDocumentExtension().
337 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) { 342 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) {
338 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 343 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
339 FilePath(FILE_PATH_LITERAL("Test.gdoc")))); 344 FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
340 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 345 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
341 FilePath(FILE_PATH_LITERAL("Test.gsheet")))); 346 FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
342 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 347 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
343 FilePath(FILE_PATH_LITERAL("Test.gslides")))); 348 FilePath(FILE_PATH_LITERAL("Test.gslides"))));
344 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 349 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP)); 387 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
383 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER, 388 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER,
384 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER)); 389 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
385 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 390 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
386 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE)); 391 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
387 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 392 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
388 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF)); 393 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
389 } 394 }
390 395
391 } // namespace gdata 396 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698