|
|
Created:
3 years, 10 months ago by Kyle Horimoto Modified:
3 years, 10 months ago CC:
chromium-reviews, jlklein+watch-tether_chromium.org, tengs+watch-tether_chromium.org, hansberry+watch-tether_chromium.org, jhawkins+watch-tether_chromium.org, oshima+watch_chromium.org, khorimoto+watch-tether_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Description[CrOS Tether] Create MessageWrapper, a wrapper class for proto messages sent for tethering. This class is used both to encode messages to be sent as well as to decode incoming messages.
BUG=672263
Review-Url: https://codereview.chromium.org/2700873002
Cr-Commit-Position: refs/heads/master@{#451944}
Committed: https://chromium.googlesource.com/chromium/src/+/d6113d41d177dee3c9585647df6e17bb3cfa39e8
Patch Set 1 #
Total comments: 10
Patch Set 2 : hansberry@ comments #Patch Set 3 : hansberry@ comments. #
Total comments: 4
Patch Set 4 : hansberry@ comments. #Patch Set 5 : Fix build. #Patch Set 6 : Rebased. #
Messages
Total messages: 48 (24 generated)
khorimoto@chromium.org changed reviewers: + hansberry@chromium.org
https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... File chromeos/components/tether/message_wrapper.cc (right): https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper.cc:23: std::unique_ptr<google::protobuf::MessageLite> DecodedMessageToProto( Why is this not a private method of MessageWrapper? https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... File chromeos/components/tether/message_wrapper_unittest.cc (right): https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:63: MessageWrapper wrapper(request); Constructing a MessageWrapper is common to all of these tests. Can you encapsulate that in VerifyProtoConversion? (would also reduce the argument count) https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:128: ss << "{data: \"" << encoded_message << "\"}"; I think JSON keys are wrapped in quotes too -- please check. https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:152: It's a PITA, but do you see any value adding a sanity check test where you craft a valid JSON dict string (e.g. {"type": 1, "data": "<actual b54 encoded data>"}) and ensure that it's parsed correctly? https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:153: } // namespace tether Please add test that makes sure this works when the JSON dict has an extra key besides "type" or "data"
https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... File chromeos/components/tether/message_wrapper.cc (right): https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper.cc:23: std::unique_ptr<google::protobuf::MessageLite> DecodedMessageToProto( On 2017/02/17 02:29:07, Ryan Hansberry wrote: > Why is this not a private method of MessageWrapper? It does not reference any instance variables of MessageWrapper, so it is better encapsulated as a static function in an anonymous namespace. https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... File chromeos/components/tether/message_wrapper_unittest.cc (right): https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:63: MessageWrapper wrapper(request); On 2017/02/17 02:29:07, Ryan Hansberry wrote: > Constructing a MessageWrapper is common to all of these tests. Can you > encapsulate that in VerifyProtoConversion? (would also reduce the argument > count) It's not a good idea to do that. MessageWrapper's constructors only take specific message types (e.g., ConnectTetheringRequest) as parameters. If we created the MessageWrapper in VerifyProtoConversion(), we would have to cast the google::protobuf::MessageLite* parameter back to the original pointer type before passing it to MessageWrapper's constructor. This would result in a switch statement on the MessageType casting the pointer to a different type based on each possible MessageType. The code is much easier to read as written. https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:128: ss << "{data: \"" << encoded_message << "\"}"; On 2017/02/17 02:29:07, Ryan Hansberry wrote: > I think JSON keys are wrapped in quotes too -- please check. Done. https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:152: On 2017/02/17 02:29:07, Ryan Hansberry wrote: > It's a PITA, but do you see any value adding a sanity check test where you craft > a valid JSON dict string (e.g. {"type": 1, "data": "<actual b54 encoded data>"}) > and ensure that it's parsed correctly? Done. https://codereview.chromium.org/2700873002/diff/1/chromeos/components/tether/... chromeos/components/tether/message_wrapper_unittest.cc:153: } // namespace tether On 2017/02/17 02:29:07, Ryan Hansberry wrote: > Please add test that makes sure this works when the JSON dict has an extra key > besides "type" or "data" Done.
lgtm w/ nits https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... File chromeos/components/tether/message_wrapper_unittest.cc (right): https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... chromeos/components/tether/message_wrapper_unittest.cc:10: #include "base/logging.h" Is this import used? https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... chromeos/components/tether/message_wrapper_unittest.cc:161: // CreateTetherAvailabilityResponse() decoded in base-64. encoded*
https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... File chromeos/components/tether/message_wrapper_unittest.cc (right): https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... chromeos/components/tether/message_wrapper_unittest.cc:10: #include "base/logging.h" On 2017/02/17 20:21:01, Ryan Hansberry wrote: > Is this import used? Oops - left over from debugging. Removed. https://codereview.chromium.org/2700873002/diff/40001/chromeos/components/tet... chromeos/components/tether/message_wrapper_unittest.cc:161: // CreateTetherAvailabilityResponse() decoded in base-64. On 2017/02/17 20:21:01, Ryan Hansberry wrote: > encoded* Done.
kkhorimoto@chromium.org changed reviewers: + kkhorimoto@chromium.org
The CQ bit was checked by kkhorimoto@chromium.org
lgtm
The patchset sent to the CQ was uploaded after l-g-t-m from hansberry@chromium.org Link to the patchset: https://codereview.chromium.org/2700873002/#ps60001 (title: "hansberry@ comments.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_...)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_...)
The CQ bit was checked by khorimoto@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from kkhorimoto@chromium.org, hansberry@chromium.org Link to the patchset: https://codereview.chromium.org/2700873002/#ps80001 (title: "Fix build.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for chromeos/components/tether/proto/tether.proto: While running git apply --index -p1; error: patch failed: chromeos/components/tether/proto/tether.proto:6 error: chromeos/components/tether/proto/tether.proto: patch does not apply Patch: chromeos/components/tether/proto/tether.proto Index: chromeos/components/tether/proto/tether.proto diff --git a/chromeos/components/tether/proto/tether.proto b/chromeos/components/tether/proto/tether.proto index 87aa63b282c610667cf02286c7ad03f24d822423..3910d190b759d6945a0bdd0abf398d79712755a7 100644 --- a/chromeos/components/tether/proto/tether.proto +++ b/chromeos/components/tether/proto/tether.proto @@ -6,7 +6,7 @@ syntax = "proto2"; -package tether; +package chromeos.tether; option optimize_for = LITE_RUNTIME;
The CQ bit was checked by khorimoto@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from kkhorimoto@chromium.org, hansberry@chromium.org Link to the patchset: https://codereview.chromium.org/2700873002/#ps100001 (title: "Rebased.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) chromium_presubmit on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by khorimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 100001, "attempt_start_ts": 1487733633077230, "parent_rev": "13668983ecf62c2b171aedb5e64deeb5dd09c494", "commit_rev": "d6113d41d177dee3c9585647df6e17bb3cfa39e8"}
Message was sent while issue was closed.
Description was changed from ========== [CrOS Tether] Create MessageWrapper, a wrapper class for proto messages sent for tethering. This class is used both to encode messages to be sent as well as to decode incoming messages. BUG=672263 ========== to ========== [CrOS Tether] Create MessageWrapper, a wrapper class for proto messages sent for tethering. This class is used both to encode messages to be sent as well as to decode incoming messages. BUG=672263 Review-Url: https://codereview.chromium.org/2700873002 Cr-Commit-Position: refs/heads/master@{#451944} Committed: https://chromium.googlesource.com/chromium/src/+/d6113d41d177dee3c9585647df6e... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as https://chromium.googlesource.com/chromium/src/+/d6113d41d177dee3c9585647df6e... |