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

Side by Side Diff: remoting/host/policy_watcher_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix platform specific stuff Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/test/mock_log.h" 12 #include "base/test/mock_log.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "components/policy/core/common/fake_async_policy_loader.h" 14 #include "components/policy/core/common/fake_async_policy_loader.h"
15 #include "policy/policy_constants.h" 15 #include "policy/policy_constants.h"
16 #include "remoting/host/dns_blackhole_checker.h" 16 #include "remoting/host/dns_blackhole_checker.h"
17 #include "remoting/host/policy_watcher.h" 17 #include "remoting/host/policy_watcher.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace remoting { 21 namespace remoting {
22 22
23 namespace key = ::policy::key; 23 namespace key = ::policy::key;
24 24
25 MATCHER_P(IsPolicies, dict, "") { 25 MATCHER_P(IsPolicies, dict, "") {
26 bool equal = arg->Equals(dict); 26 bool equal = arg->Equals(dict);
27 if (!equal) { 27 if (!equal) {
28 std::string actual_value; 28 std::string actual_value;
29 base::JSONWriter::WriteWithOptions( 29 base::JSONWriter::WriteWithOptions(
30 arg, base::JSONWriter::OPTIONS_PRETTY_PRINT, &actual_value); 30 *arg, base::JSONWriter::OPTIONS_PRETTY_PRINT, &actual_value);
31 31
32 std::string expected_value; 32 std::string expected_value;
33 base::JSONWriter::WriteWithOptions( 33 base::JSONWriter::WriteWithOptions(
34 dict, base::JSONWriter::OPTIONS_PRETTY_PRINT, &expected_value); 34 *dict, base::JSONWriter::OPTIONS_PRETTY_PRINT, &expected_value);
35 35
36 *result_listener << "Policies are not equal. "; 36 *result_listener << "Policies are not equal. ";
37 *result_listener << "Expected policy: " << expected_value << ". "; 37 *result_listener << "Expected policy: " << expected_value << ". ";
38 *result_listener << "Actual policy: " << actual_value << "."; 38 *result_listener << "Actual policy: " << actual_value << ".";
39 } 39 }
40 return equal; 40 return equal;
41 } 41 }
42 42
43 class MockPolicyCallback { 43 class MockPolicyCallback {
44 public: 44 public:
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 743 }
744 744
745 // Today, the only verification offered by this test is: 745 // Today, the only verification offered by this test is:
746 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy 746 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy
747 // - Automated verification that nothing crashed 747 // - Automated verification that nothing crashed
748 } 748 }
749 749
750 #endif 750 #endif
751 751
752 } // namespace remoting 752 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698