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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_service_browsertest.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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
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_reader.h" 9 #include "base/json/json_reader.h"
10 #include "chrome/browser/google_apis/auth_service.h" 10 #include "chrome/browser/google_apis/auth_service.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 } // namespace 75 } // namespace
76 76
77 IN_PROC_BROWSER_TEST_F(GDataTest, Download) { 77 IN_PROC_BROWSER_TEST_F(GDataTest, Download) {
78 GDataErrorCode result = GDATA_OTHER_ERROR; 78 GDataErrorCode result = GDATA_OTHER_ERROR;
79 std::string contents; 79 std::string contents;
80 service_->DownloadFile( 80 service_->DownloadFile(
81 FilePath(FILE_PATH_LITERAL("/dummy/gdata/testfile.txt")), 81 FilePath(FILE_PATH_LITERAL("/dummy/gdata/testfile.txt")),
82 GetTestCachedFilePath(FilePath( 82 GetTestCachedFilePath(FilePath(
83 FILE_PATH_LITERAL("cached_testfile.txt"))), 83 FILE_PATH_LITERAL("cached_testfile.txt"))),
84 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), 84 gdata_test_server_.GetURL("files/gdata/testfile.txt"),
85 base::Bind(&TestDownloadCallback, &result, &contents), 85 base::Bind(&TestDownloadCallback, &result, &contents),
86 GetContentCallback()); 86 GetContentCallback());
87 content::RunMessageLoop(); 87 content::RunMessageLoop();
88 88
89 EXPECT_EQ(HTTP_SUCCESS, result); 89 EXPECT_EQ(HTTP_SUCCESS, result);
90 FilePath expected_filepath = gdata_test_server_.document_root().Append( 90 FilePath expected_filepath = gdata_test_server_.document_root().Append(
91 FilePath(FILE_PATH_LITERAL("chromeos/gdata/testfile.txt"))); 91 FilePath(FILE_PATH_LITERAL("gdata/testfile.txt")));
92 std::string expected_contents; 92 std::string expected_contents;
93 file_util::ReadFileToString(expected_filepath, &expected_contents); 93 file_util::ReadFileToString(expected_filepath, &expected_contents);
94 EXPECT_EQ(expected_contents, contents); 94 EXPECT_EQ(expected_contents, contents);
95 } 95 }
96 96
97 IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) { 97 IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) {
98 GDataErrorCode result = GDATA_OTHER_ERROR; 98 GDataErrorCode result = GDATA_OTHER_ERROR;
99 std::string dummy_contents; 99 std::string dummy_contents;
100 service_->DownloadFile( 100 service_->DownloadFile(
101 FilePath(FILE_PATH_LITERAL("/dummy/gdata/no-such-file.txt")), 101 FilePath(FILE_PATH_LITERAL("/dummy/gdata/no-such-file.txt")),
102 GetTestCachedFilePath(FilePath( 102 GetTestCachedFilePath(FilePath(
103 FILE_PATH_LITERAL("cache_no-such-file.txt"))), 103 FILE_PATH_LITERAL("cache_no-such-file.txt"))),
104 gdata_test_server_.GetURL("files/chromeos/gdata/no-such-file.txt"), 104 gdata_test_server_.GetURL("files/gdata/no-such-file.txt"),
105 base::Bind(&TestDownloadCallback, &result, &dummy_contents), 105 base::Bind(&TestDownloadCallback, &result, &dummy_contents),
106 GetContentCallback()); 106 GetContentCallback());
107 content::RunMessageLoop(); 107 content::RunMessageLoop();
108 108
109 EXPECT_EQ(HTTP_NOT_FOUND, result); 109 EXPECT_EQ(HTTP_NOT_FOUND, result);
110 // Do not verify the not found message. 110 // Do not verify the not found message.
111 } 111 }
112 112
113 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { 113 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) {
114 GDataErrorCode result = GDATA_OTHER_ERROR; 114 GDataErrorCode result = GDATA_OTHER_ERROR;
115 base::Value* result_data = NULL; 115 base::Value* result_data = NULL;
116 service_->GetDocuments( 116 service_->GetDocuments(
117 gdata_test_server_.GetURL("files/chromeos/gdata/root_feed.json"), 117 gdata_test_server_.GetURL("files/gdata/root_feed.json"),
118 0, // start_changestamp 118 0, // start_changestamp
119 std::string(), // search string 119 std::string(), // search string
120 std::string(), // directory resource ID 120 std::string(), // directory resource ID
121 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 121 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
122 content::RunMessageLoop(); 122 content::RunMessageLoop();
123 123
124 EXPECT_EQ(HTTP_SUCCESS, result); 124 EXPECT_EQ(HTTP_SUCCESS, result);
125 ASSERT_TRUE(result_data); 125 ASSERT_TRUE(result_data);
126 FilePath expected_filepath = gdata_test_server_.document_root().Append( 126 FilePath expected_filepath = gdata_test_server_.document_root().Append(
127 FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json"))); 127 FilePath(FILE_PATH_LITERAL("gdata/root_feed.json")));
128 std::string expected_contents; 128 std::string expected_contents;
129 file_util::ReadFileToString(expected_filepath, &expected_contents); 129 file_util::ReadFileToString(expected_filepath, &expected_contents);
130 scoped_ptr<base::Value> expected_data( 130 scoped_ptr<base::Value> expected_data(
131 base::JSONReader::Read(expected_contents)); 131 base::JSONReader::Read(expected_contents));
132 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data)); 132 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data));
133 delete result_data; 133 delete result_data;
134 } 134 }
135 135
136 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { 136 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) {
137 // testfile.txt exists but the response is not JSON, so it should 137 // testfile.txt exists but the response is not JSON, so it should
138 // emit a parse error instead. 138 // emit a parse error instead.
139 GDataErrorCode result = GDATA_OTHER_ERROR; 139 GDataErrorCode result = GDATA_OTHER_ERROR;
140 base::Value* result_data = NULL; 140 base::Value* result_data = NULL;
141 service_->GetDocuments( 141 service_->GetDocuments(
142 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), 142 gdata_test_server_.GetURL("files/gdata/testfile.txt"),
143 0, // start_changestamp 143 0, // start_changestamp
144 std::string(), // search string 144 std::string(), // search string
145 std::string(), // directory resource ID 145 std::string(), // directory resource ID
146 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 146 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
147 content::RunMessageLoop(); 147 content::RunMessageLoop();
148 148
149 EXPECT_EQ(GDATA_PARSE_ERROR, result); 149 EXPECT_EQ(GDATA_PARSE_ERROR, result);
150 EXPECT_FALSE(result_data); 150 EXPECT_FALSE(result_data);
151 } 151 }
152 152
153 } // namespace google_apis 153 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698