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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_documents_service_browsertest.cc

Issue 10274002: Add gdata content search (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix renaming Created 8 years, 7 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 "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/chromeos/gdata/gdata_documents_service.h" 10 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 EXPECT_EQ(gdata::HTTP_NOT_FOUND, result); 104 EXPECT_EQ(gdata::HTTP_NOT_FOUND, result);
105 // Do not verify the not found message. 105 // Do not verify the not found message.
106 } 106 }
107 107
108 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { 108 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) {
109 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 109 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
110 base::Value* result_data = NULL; 110 base::Value* result_data = NULL;
111 service_->GetDocuments( 111 service_->GetDocuments(
112 gdata_test_server_.GetURL("files/chromeos/gdata/root_feed.json"), 112 gdata_test_server_.GetURL("files/chromeos/gdata/root_feed.json"),
113 0, // start_changestamp 113 0, // start_changestamp
114 std::string(), // search string
114 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 115 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
115 ui_test_utils::RunMessageLoop(); 116 ui_test_utils::RunMessageLoop();
116 117
117 EXPECT_EQ(gdata::HTTP_SUCCESS, result); 118 EXPECT_EQ(gdata::HTTP_SUCCESS, result);
118 ASSERT_TRUE(result_data); 119 ASSERT_TRUE(result_data);
119 FilePath expected_filepath = gdata_test_server_.document_root().Append( 120 FilePath expected_filepath = gdata_test_server_.document_root().Append(
120 FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json"))); 121 FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json")));
121 std::string expected_contents; 122 std::string expected_contents;
122 file_util::ReadFileToString(expected_filepath, &expected_contents); 123 file_util::ReadFileToString(expected_filepath, &expected_contents);
123 scoped_ptr<base::Value> expected_data( 124 scoped_ptr<base::Value> expected_data(
124 base::JSONReader::Read(expected_contents)); 125 base::JSONReader::Read(expected_contents));
125 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data)); 126 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data));
126 delete result_data; 127 delete result_data;
127 } 128 }
128 129
129 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { 130 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) {
130 // testfile.txt exists but the response is not JSON, so it should 131 // testfile.txt exists but the response is not JSON, so it should
131 // emit a parse error instead. 132 // emit a parse error instead.
132 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 133 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
133 base::Value* result_data = NULL; 134 base::Value* result_data = NULL;
134 service_->GetDocuments( 135 service_->GetDocuments(
135 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), 136 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"),
136 0, // start_changestamp 137 0, // start_changestamp
138 std::string(), // search string
137 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 139 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
138 ui_test_utils::RunMessageLoop(); 140 ui_test_utils::RunMessageLoop();
139 141
140 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result); 142 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result);
141 EXPECT_FALSE(result_data); 143 EXPECT_FALSE(result_data);
142 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698