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

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

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 111 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
112 ui_test_utils::RunMessageLoop(); 112 ui_test_utils::RunMessageLoop();
113 113
114 EXPECT_EQ(gdata::HTTP_SUCCESS, result); 114 EXPECT_EQ(gdata::HTTP_SUCCESS, result);
115 ASSERT_TRUE(result_data); 115 ASSERT_TRUE(result_data);
116 FilePath expected_filepath = gdata_test_server_.document_root().Append( 116 FilePath expected_filepath = gdata_test_server_.document_root().Append(
117 FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json"))); 117 FilePath(FILE_PATH_LITERAL("chromeos/gdata/root_feed.json")));
118 std::string expected_contents; 118 std::string expected_contents;
119 file_util::ReadFileToString(expected_filepath, &expected_contents); 119 file_util::ReadFileToString(expected_filepath, &expected_contents);
120 scoped_ptr<base::Value> expected_data( 120 scoped_ptr<base::Value> expected_data(
121 base::JSONReader::Read(expected_contents, false)); 121 base::JSONReader::Read(expected_contents));
122 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data)); 122 EXPECT_TRUE(base::Value::Equals(expected_data.get(), result_data));
123 delete result_data; 123 delete result_data;
124 } 124 }
125 125
126 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) { 126 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocumentsFailure) {
127 // testfile.txt exists but the response is not JSON, so it should 127 // testfile.txt exists but the response is not JSON, so it should
128 // emit a parse error instead. 128 // emit a parse error instead.
129 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 129 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
130 base::Value* result_data = NULL; 130 base::Value* result_data = NULL;
131 service_->GetDocuments( 131 service_->GetDocuments(
132 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), 132 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"),
133 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 133 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
134 ui_test_utils::RunMessageLoop(); 134 ui_test_utils::RunMessageLoop();
135 135
136 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result); 136 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result);
137 EXPECT_FALSE(result_data); 137 EXPECT_FALSE(result_data);
138 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698