Move rtc_json code from API dir, enable unit test, unmark testonly

This change does three things:
 - Move rtc_json into rtc_base/strings/, a non-API directory more fitting to
   its purpose.
 - Make a target for the currently unused json_unittest.
 - Make the code available for use in non-test code again.

Bug: webrtc:9802
Change-Id: Id964a8a4b47b732a962a364894a4dbd3e7f4650f
Reviewed-on: https://webrtc-review.googlesource.com/103126
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24932}
This commit is contained in:
Sam Zackrisson
2018-10-02 16:25:59 +02:00
committed by Commit Bot
parent bfff4bac82
commit b45bdb524c
9 changed files with 27 additions and 13 deletions

View File

@ -465,6 +465,7 @@ if (rtc_include_tests) {
"rtc_base:rtc_base_tests_main",
"rtc_base:rtc_base_tests_utils",
"rtc_base:rtc_base_unittests",
"rtc_base:rtc_json_unittests",
"rtc_base:rtc_numerics_unittests",
"rtc_base:rtc_task_queue_unittests",
"rtc_base:sequenced_task_checker_unittests",

View File

@ -24,8 +24,8 @@
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/video_capture/video_capture_factory.h"
#include "rtc_base/checks.h"
#include "rtc_base/json.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/json.h"
// Names used for a IceCandidate JSON object.
const char kCandidateSdpMidName[] = "sdpMid";

View File

@ -24,8 +24,8 @@
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/test/fake_recording_device.h"
#include "rtc_base/checks.h"
#include "rtc_base/json.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/json.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/stringutils.h"

View File

@ -683,11 +683,10 @@ rtc_static_library("rtc_numerics") {
}
rtc_source_set("rtc_json") {
testonly = true
defines = []
sources = [
"json.cc",
"json.h",
"strings/json.cc",
"strings/json.h",
]
deps = [
":stringutils",
@ -1264,6 +1263,20 @@ if (rtc_include_tests) {
]
}
rtc_source_set("rtc_json_unittests") {
testonly = true
sources = [
"strings/json_unittest.cc",
]
deps = [
":rtc_base_tests_main",
":rtc_base_tests_utils",
":rtc_json",
"../test:test_support",
]
}
rtc_source_set("rtc_base_unittests") {
testonly = true
defines = []

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/json.h"
#include "rtc_base/strings/json.h"
#include <errno.h>
#include <limits.h>

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_JSON_H_
#define RTC_BASE_JSON_H_
#ifndef RTC_BASE_STRINGS_JSON_H_
#define RTC_BASE_STRINGS_JSON_H_
#include <string>
#include <vector>
@ -85,4 +85,4 @@ std::string JsonValueToString(const Json::Value& json);
} // namespace rtc
#endif // RTC_BASE_JSON_H_
#endif // RTC_BASE_STRINGS_JSON_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/json.h"
#include "rtc_base/strings/json.h"
#include <vector>
@ -88,7 +88,7 @@ TEST(JsonTest, GetUInt) {
EXPECT_TRUE(GetUIntFromJson(big_u, &out));
EXPECT_EQ(0xFFFFFFFFU, out);
EXPECT_FALSE(GetUIntFromJson(in_s, &out));
// TODO: Fail reading negative strings.
// TODO(bugs.webrtc.org/9804): Fail reading negative strings.
// EXPECT_FALSE(GetUIntFromJson(in_si, &out));
EXPECT_FALSE(GetUIntFromJson(in_i, &out));
EXPECT_FALSE(GetUIntFromJson(big_sn, &out));

View File

@ -15,7 +15,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/gunit.h"
#include "rtc_base/json.h"
#include "rtc_base/strings/json.h"
#include "stats/test/rtcteststats.h"
namespace webrtc {

View File

@ -24,8 +24,8 @@
#include "rtc_base/checks.h"
#include "rtc_base/file.h"
#include "rtc_base/flags.h"
#include "rtc_base/json.h"
#include "rtc_base/string_to_number.h"
#include "rtc_base/strings/json.h"
#include "rtc_base/timeutils.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/sleep.h"