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

Side by Side Diff: google_apis/drive/drive_api_parser_unittest.cc

Issue 125553004: Parse createUrl field of apps.list Drive API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/gdata_wapi_parser.h" 9 #include "google_apis/drive/gdata_wapi_parser.h"
10 #include "google_apis/drive/test_util.h" 10 #include "google_apis/drive/test_util.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const DriveAppIcon& icon1 = *app1.icons()[0]; 75 const DriveAppIcon& icon1 = *app1.icons()[0];
76 EXPECT_EQ(DriveAppIcon::APPLICATION, icon1.category()); 76 EXPECT_EQ(DriveAppIcon::APPLICATION, icon1.category());
77 EXPECT_EQ(10, icon1.icon_side_length()); 77 EXPECT_EQ(10, icon1.icon_side_length());
78 EXPECT_EQ("http://www.example.com/10.png", icon1.icon_url().spec()); 78 EXPECT_EQ("http://www.example.com/10.png", icon1.icon_url().spec());
79 79
80 const DriveAppIcon& icon6 = *app1.icons()[5]; 80 const DriveAppIcon& icon6 = *app1.icons()[5];
81 EXPECT_EQ(DriveAppIcon::SHARED_DOCUMENT, icon6.category()); 81 EXPECT_EQ(DriveAppIcon::SHARED_DOCUMENT, icon6.category());
82 EXPECT_EQ(16, icon6.icon_side_length()); 82 EXPECT_EQ(16, icon6.icon_side_length());
83 EXPECT_EQ("http://www.example.com/ds16.png", icon6.icon_url().spec()); 83 EXPECT_EQ("http://www.example.com/ds16.png", icon6.icon_url().spec());
84 84
85 EXPECT_EQ("https://www.example.com/createForApp1", app1.create_url().spec());
86
85 // Check Drive app 2 87 // Check Drive app 2
86 const AppResource& app2 = *applist->items()[1]; 88 const AppResource& app2 = *applist->items()[1];
87 EXPECT_EQ("876543210000", app2.application_id()); 89 EXPECT_EQ("876543210000", app2.application_id());
88 EXPECT_EQ("Drive app 2", app2.name()); 90 EXPECT_EQ("Drive app 2", app2.name());
89 EXPECT_EQ("", app2.object_type()); 91 EXPECT_EQ("", app2.object_type());
90 EXPECT_FALSE(app2.supports_create()); 92 EXPECT_FALSE(app2.supports_create());
91 EXPECT_FALSE(app2.supports_import()); 93 EXPECT_FALSE(app2.supports_import());
92 EXPECT_TRUE(app2.is_installed()); 94 EXPECT_TRUE(app2.is_installed());
93 EXPECT_FALSE(app2.is_authorized()); 95 EXPECT_FALSE(app2.is_authorized());
94 EXPECT_EQ("https://chrome.google.com/webstore/detail/" 96 EXPECT_EQ("https://chrome.google.com/webstore/detail/"
95 "hgfedcbahgfedcbahgfedcbahgfedcba", 97 "hgfedcbahgfedcbahgfedcbahgfedcba",
96 app2.product_url().spec()); 98 app2.product_url().spec());
97 99
98 ASSERT_EQ(3U, app2.primary_mimetypes().size()); 100 ASSERT_EQ(3U, app2.primary_mimetypes().size());
99 EXPECT_EQ("image/jpeg", *app2.primary_mimetypes()[0]); 101 EXPECT_EQ("image/jpeg", *app2.primary_mimetypes()[0]);
100 EXPECT_EQ("image/png", *app2.primary_mimetypes()[1]); 102 EXPECT_EQ("image/png", *app2.primary_mimetypes()[1]);
101 EXPECT_EQ("application/vnd.google-apps.drive-sdk.876543210000", 103 EXPECT_EQ("application/vnd.google-apps.drive-sdk.876543210000",
102 *app2.primary_mimetypes()[2]); 104 *app2.primary_mimetypes()[2]);
103 105
104 EXPECT_EQ(0U, app2.secondary_mimetypes().size()); 106 EXPECT_EQ(0U, app2.secondary_mimetypes().size());
105 EXPECT_EQ(0U, app2.primary_file_extensions().size()); 107 EXPECT_EQ(0U, app2.primary_file_extensions().size());
106 EXPECT_EQ(0U, app2.secondary_file_extensions().size()); 108 EXPECT_EQ(0U, app2.secondary_file_extensions().size());
107 109
108 ASSERT_EQ(3U, app2.icons().size()); 110 ASSERT_EQ(3U, app2.icons().size());
109 const DriveAppIcon& icon2 = *app2.icons()[1]; 111 const DriveAppIcon& icon2 = *app2.icons()[1];
110 EXPECT_EQ(DriveAppIcon::DOCUMENT, icon2.category()); 112 EXPECT_EQ(DriveAppIcon::DOCUMENT, icon2.category());
111 EXPECT_EQ(10, icon2.icon_side_length()); 113 EXPECT_EQ(10, icon2.icon_side_length());
112 EXPECT_EQ("http://www.example.com/d10.png", icon2.icon_url().spec()); 114 EXPECT_EQ("http://www.example.com/d10.png", icon2.icon_url().spec());
115
116 EXPECT_EQ("https://www.example.com/createForApp2", app2.create_url().spec());
113 } 117 }
114 118
115 // Test file list parsing. 119 // Test file list parsing.
116 TEST(DriveAPIParserTest, FileListParser) { 120 TEST(DriveAPIParserTest, FileListParser) {
117 std::string error; 121 std::string error;
118 scoped_ptr<base::Value> document = test_util::LoadJSONFile( 122 scoped_ptr<base::Value> document = test_util::LoadJSONFile(
119 "drive/filelist.json"); 123 "drive/filelist.json");
120 ASSERT_TRUE(document.get()); 124 ASSERT_TRUE(document.get());
121 125
122 ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType()); 126 ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType());
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 test_util::LoadJSONFile("drive/filelist.json")); 299 test_util::LoadJSONFile("drive/filelist.json"));
296 300
297 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json)); 301 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json));
298 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json)); 302 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json));
299 303
300 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json)); 304 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json));
301 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json)); 305 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json));
302 } 306 }
303 307
304 } // namespace google_apis 308 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698