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

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

Issue 12861002: drive: Remove "/-/mine" from WAPI resource list urls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified the test feed to include an not-mine entry. Created 7 years, 9 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/google_apis/fake_drive_service.h" 5 #include "chrome/browser/google_apis/fake_drive_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 false, // shared_with_me 106 false, // shared_with_me
107 "", // directory_resource_id 107 "", // directory_resource_id
108 base::Bind(&test_util::CopyResultsFromGetResourceListCallback, 108 base::Bind(&test_util::CopyResultsFromGetResourceListCallback,
109 &error, 109 &error,
110 &resource_list)); 110 &resource_list));
111 message_loop_.RunUntilIdle(); 111 message_loop_.RunUntilIdle();
112 112
113 EXPECT_EQ(HTTP_SUCCESS, error); 113 EXPECT_EQ(HTTP_SUCCESS, error);
114 ASSERT_TRUE(resource_list); 114 ASSERT_TRUE(resource_list);
115 // Do some sanity check. 115 // Do some sanity check.
116 EXPECT_EQ(13U, resource_list->entries().size()); 116 EXPECT_EQ(14U, resource_list->entries().size());
117 EXPECT_EQ(1, fake_service_.resource_list_load_count()); 117 EXPECT_EQ(1, fake_service_.resource_list_load_count());
118 } 118 }
119 119
120 TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndex) { 120 TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndex) {
121 ASSERT_TRUE(fake_service_.LoadResourceListForWapi( 121 ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
122 "chromeos/gdata/root_feed.json")); 122 "chromeos/gdata/root_feed.json"));
123 123
124 GDataErrorCode error = GDATA_OTHER_ERROR; 124 GDataErrorCode error = GDATA_OTHER_ERROR;
125 scoped_ptr<ResourceList> resource_list; 125 scoped_ptr<ResourceList> resource_list;
126 fake_service_.GetResourceList( 126 fake_service_.GetResourceList(
127 GURL("http://dummyurl/?start-offset=2"), 127 GURL("http://dummyurl/?start-offset=2"),
128 0, // start_changestamp 128 0, // start_changestamp
129 "", // search_query 129 "", // search_query
130 false, // shared_with_me 130 false, // shared_with_me
131 "", // directory_resource_id 131 "", // directory_resource_id
132 base::Bind(&test_util::CopyResultsFromGetResourceListCallback, 132 base::Bind(&test_util::CopyResultsFromGetResourceListCallback,
133 &error, 133 &error,
134 &resource_list)); 134 &resource_list));
135 message_loop_.RunUntilIdle(); 135 message_loop_.RunUntilIdle();
136 136
137 EXPECT_EQ(HTTP_SUCCESS, error); 137 EXPECT_EQ(HTTP_SUCCESS, error);
138 ASSERT_TRUE(resource_list); 138 ASSERT_TRUE(resource_list);
139 // Because the start-offset was set to 2, the size should be 11 instead of 139 // Because the start-offset was set to 2, the size should be 12 instead of
140 // 13 (the total number). 140 // 14 (the total number).
141 EXPECT_EQ(11U, resource_list->entries().size()); 141 EXPECT_EQ(12U, resource_list->entries().size());
142 EXPECT_EQ(1, fake_service_.resource_list_load_count()); 142 EXPECT_EQ(1, fake_service_.resource_list_load_count());
143 } 143 }
144 144
145 TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndexAndMaxResults) { 145 TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndexAndMaxResults) {
146 ASSERT_TRUE(fake_service_.LoadResourceListForWapi( 146 ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
147 "chromeos/gdata/root_feed.json")); 147 "chromeos/gdata/root_feed.json"));
148 148
149 GDataErrorCode error = GDATA_OTHER_ERROR; 149 GDataErrorCode error = GDATA_OTHER_ERROR;
150 scoped_ptr<ResourceList> resource_list; 150 scoped_ptr<ResourceList> resource_list;
151 fake_service_.GetResourceList( 151 fake_service_.GetResourceList(
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1514
1515 EXPECT_EQ(HTTP_CREATED, response.code); 1515 EXPECT_EQ(HTTP_CREATED, response.code);
1516 EXPECT_TRUE(entry.get()); 1516 EXPECT_TRUE(entry.get());
1517 EXPECT_EQ(15L, entry->file_size()); 1517 EXPECT_EQ(15L, entry->file_size());
1518 EXPECT_TRUE(Exists(entry->resource_id())); 1518 EXPECT_TRUE(Exists(entry->resource_id()));
1519 } 1519 }
1520 1520
1521 } // namespace 1521 } // namespace
1522 1522
1523 } // namespace google_apis 1523 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698