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

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

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up, MockLog uses listener Created 4 years, 5 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 "remoting/host/policy_watcher.h" 5 #include "remoting/host/policy_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 class MisspelledPolicyTest : public PolicyWatcherTest, 427 class MisspelledPolicyTest : public PolicyWatcherTest,
428 public ::testing::WithParamInterface<const char*> { 428 public ::testing::WithParamInterface<const char*> {
429 }; 429 };
430 430
431 // Verify that a misspelled policy causes a warning written to the log. 431 // Verify that a misspelled policy causes a warning written to the log.
432 TEST_P(MisspelledPolicyTest, WarningLogged) { 432 TEST_P(MisspelledPolicyTest, WarningLogged) {
433 const char* misspelled_policy_name = GetParam(); 433 const char* misspelled_policy_name = GetParam();
434 base::test::MockLog mock_log; 434 base::test::MockLog mock_log;
435 435
436 ON_CALL(mock_log, Log(testing::_, testing::_, testing::_, testing::_,
437 testing::_)).WillByDefault(testing::Return(true));
438
439 EXPECT_CALL(mock_log, 436 EXPECT_CALL(mock_log,
440 Log(logging::LOG_WARNING, testing::_, testing::_, testing::_, 437 Log(logging::LOG_WARNING, testing::_, testing::_, testing::_,
441 testing::HasSubstr(misspelled_policy_name))).Times(1); 438 testing::HasSubstr(misspelled_policy_name))).Times(1);
442 439
443 EXPECT_CALL(mock_policy_callback_, 440 EXPECT_CALL(mock_policy_callback_,
444 OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_))); 441 OnPolicyUpdatePtr(IsPolicies(&nat_true_others_default_)));
445 442
446 base::DictionaryValue misspelled_policies; 443 base::DictionaryValue misspelled_policies;
447 misspelled_policies.SetString(misspelled_policy_name, "some test value"); 444 misspelled_policies.SetString(misspelled_policy_name, "some test value");
448 mock_log.StartCapturingLogs(); 445 mock_log.StartCapturingLogs();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 644
648 // And check one, random "boolean" policy to see if the type propagated 645 // And check one, random "boolean" policy to see if the type propagated
649 // correctly from policy_templates.json file. 646 // correctly from policy_templates.json file.
650 const policy::Schema boolean_schema = 647 const policy::Schema boolean_schema =
651 schema->GetKnownProperty("RemoteAccessHostRequireCurtain"); 648 schema->GetKnownProperty("RemoteAccessHostRequireCurtain");
652 EXPECT_TRUE(boolean_schema.valid()); 649 EXPECT_TRUE(boolean_schema.valid());
653 EXPECT_EQ(boolean_schema.type(), base::Value::Type::TYPE_BOOLEAN); 650 EXPECT_EQ(boolean_schema.type(), base::Value::Type::TYPE_BOOLEAN);
654 } 651 }
655 652
656 } // namespace remoting 653 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698