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

Side by Side Diff: chrome/browser/safe_json_parser_browsertest.cc

Issue 1140053003: Refactoring: Moving the SafeJsonParser to its own component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catching up with WebstoreInstallHelper changes Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/safe_json_parser.h"
11 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "components/safe_json_parser/safe_json_parser.h"
12 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
14 14
15 namespace { 15 namespace {
16 16
17 using safe_json_parser::SafeJsonParser;
18
17 std::string MaybeToJson(const base::Value* value) { 19 std::string MaybeToJson(const base::Value* value) {
18 if (!value) 20 if (!value)
19 return "(null)"; 21 return "(null)";
20 22
21 std::string json; 23 std::string json;
22 if (!base::JSONWriter::Write(*value, &json)) 24 if (!base::JSONWriter::Write(*value, &json))
23 return "(invalid value)"; 25 return "(invalid value)";
24 26
25 return json; 27 return json;
26 } 28 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 TestParse("\"laser\""); 97 TestParse("\"laser\"");
96 TestParse("false"); 98 TestParse("false");
97 TestParse("null"); 99 TestParse("null");
98 TestParse("3.14"); 100 TestParse("3.14");
99 TestParse("["); 101 TestParse("[");
100 TestParse("\""); 102 TestParse("\"");
101 TestParse(std::string()); 103 TestParse(std::string());
102 TestParse("☃"); 104 TestParse("☃");
103 TestParse("\"☃\""); 105 TestParse("\"☃\"");
104 } 106 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_json_parser.cc ('k') | chrome/browser/supervised_user/supervised_user_site_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698