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

Unified Diff: components/pairing/fake_controller_pairing_controller.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
Index: components/pairing/fake_controller_pairing_controller.cc
diff --git a/components/pairing/fake_controller_pairing_controller.cc b/components/pairing/fake_controller_pairing_controller.cc
index 2eca750bcf4af866c6edec6f85ed0d8063c2b9f1..d0aaf1f789eb91a128d11d158c6a02f2bcd27122 100644
--- a/components/pairing/fake_controller_pairing_controller.cc
+++ b/components/pairing/fake_controller_pairing_controller.cc
@@ -37,14 +37,14 @@ void FakeControllerPairingController::ApplyConfig(const std::string& config) {
typedef std::vector<std::string> Tokens;
base::StringPairs kv_pairs;
- CHECK(base::SplitStringIntoKeyValuePairs(config, ':', ',', &kv_pairs))
- << "Wrong config format.";
+ // Wrong config format.
+ CHECK(base::SplitStringIntoKeyValuePairs(config, ':', ',', &kv_pairs));
std::map<std::string, std::string> dict(kv_pairs.begin(), kv_pairs.end());
if (dict.count("async_duration")) {
int ms = 0;
- CHECK(base::StringToInt(dict["async_duration"], &ms))
- << "Wrong 'async_duration' format.";
+ // Wrong 'async_duration' format.
+ CHECK(base::StringToInt(dict["async_duration"], &ms));
async_duration_ = base::TimeDelta::FromMilliseconds(ms);
} else {
async_duration_ = base::TimeDelta::FromMilliseconds(3000);
@@ -60,16 +60,17 @@ void FakeControllerPairingController::ApplyConfig(const std::string& config) {
Tokens lost_begin_end = base::SplitString(
dict["connection_lost"], "-", base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
- CHECK_EQ(2u, lost_begin_end.size()) << "Wrong 'connection_lost' format.";
+ // Wrong 'connection_lost' format.
+ CHECK_EQ(2u, lost_begin_end.size());
int begin = 0;
int end = 0;
+ // Wrong 'connection_lost' format.
CHECK(base::StringToInt(lost_begin_end[0], &begin) &&
- base::StringToInt(lost_begin_end[1], &end))
- << "Wrong 'connection_lost' format.";
+ base::StringToInt(lost_begin_end[1], &end));
+ // Wrong 'connection_lost' interval.
CHECK((begin == 0 && end == 0) ||
(STAGE_WAITING_FOR_CODE_CONFIRMATION <= begin && begin <= end &&
- end <= STAGE_HOST_ENROLLMENT_ERROR))
- << "Wrong 'connection_lost' interval.";
+ end <= STAGE_HOST_ENROLLMENT_ERROR));
connection_lost_begin_ = static_cast<Stage>(begin);
connection_lost_end_ = static_cast<Stage>(end);
} else {
@@ -81,16 +82,17 @@ void FakeControllerPairingController::ApplyConfig(const std::string& config) {
"F-Device_1~F-Device_5~F-Device_3~L-Device_3~L-Device_1~F-Device_1";
}
base::StringPairs events;
+ // Wrong 'discovery' format.
CHECK(
- base::SplitStringIntoKeyValuePairs(dict["discovery"], '-', '~', &events))
- << "Wrong 'discovery' format.";
+ base::SplitStringIntoKeyValuePairs(dict["discovery"], '-', '~', &events));
DiscoveryScenario scenario;
for (const auto& event : events) {
const std::string& type = event.first;
const std::string& device_id = event.second;
- CHECK(type == "F" || type == "L" || type == "N")
- << "Wrong discovery event type.";
- CHECK(!device_id.empty() || type == "N") << "Empty device ID.";
+ // Wrong discovery event type.
+ CHECK(type == "F" || type == "L" || type == "N");
+ // Empty device ID.
+ CHECK(!device_id.empty() || type == "N");
scenario.push_back(DiscoveryEvent(
type == "F" ? DEVICE_FOUND : type == "L" ? DEVICE_LOST : NOTHING_FOUND,
device_id));
@@ -98,11 +100,11 @@ void FakeControllerPairingController::ApplyConfig(const std::string& config) {
SetDiscoveryScenario(scenario);
preset_confirmation_code_ = dict["code"];
+ // Wrong 'code' format.
CHECK(preset_confirmation_code_.empty() ||
(preset_confirmation_code_.length() == 6 &&
preset_confirmation_code_.find_first_not_of("0123456789") ==
- std::string::npos))
- << "Wrong 'code' format.";
+ std::string::npos));
}
void FakeControllerPairingController::SetShouldFailOnConnecting() {

Powered by Google App Engine
This is Rietveld 408576698