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

Unified Diff: content/browser/webui/web_ui_data_source_unittest.cc

Issue 2391073005: WebUIDataSource::AddInteger (like AddBoolean/AddString) (Closed)
Patch Set: DateTimeHandler usage of SetInteger Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.cc ('k') | content/public/browser/web_ui_data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/web_ui_data_source_unittest.cc
diff --git a/content/browser/webui/web_ui_data_source_unittest.cc b/content/browser/webui/web_ui_data_source_unittest.cc
index cf9729723ff82334ecda49f6de773d5938e40df6..c39aa6b02460524cda0e590955e71d7a8307be27 100644
--- a/content/browser/webui/web_ui_data_source_unittest.cc
+++ b/content/browser/webui/web_ui_data_source_unittest.cc
@@ -103,17 +103,23 @@ TEST_F(WebUIDataSourceTest, EmptyStrings) {
StartDataRequest("strings.js", base::Bind(&EmptyStringsCallback));
}
-void SomeStringsCallback(scoped_refptr<base::RefCountedMemory> data) {
+void SomeValuesCallback(scoped_refptr<base::RefCountedMemory> data) {
std::string result(data->front_as<char>(), data->size());
+ EXPECT_NE(result.find("\"flag\":true"), std::string::npos);
+ EXPECT_NE(result.find("\"counter\":10"), std::string::npos);
+ EXPECT_NE(result.find("\"debt\":-456"), std::string::npos);
EXPECT_NE(result.find("\"planet\":\"pluto\""), std::string::npos);
EXPECT_NE(result.find("\"button\":\"foo\""), std::string::npos);
}
-TEST_F(WebUIDataSourceTest, SomeStrings) {
+TEST_F(WebUIDataSourceTest, SomeValues) {
source()->SetJsonPath("strings.js");
+ source()->AddBoolean("flag", true);
+ source()->AddInteger("counter", 10);
+ source()->AddInteger("debt", -456);
source()->AddString("planet", base::ASCIIToUTF16("pluto"));
source()->AddLocalizedString("button", kDummyStringId);
- StartDataRequest("strings.js", base::Bind(&SomeStringsCallback));
+ StartDataRequest("strings.js", base::Bind(&SomeValuesCallback));
}
void DefaultResourceFoobarCallback(scoped_refptr<base::RefCountedMemory> data) {
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.cc ('k') | content/public/browser/web_ui_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698