OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 } | 548 } |
549 | 549 |
550 } // anonymous namespace | 550 } // anonymous namespace |
551 | 551 |
552 // To dump policy contents, run unit tests with the following flags: | 552 // To dump policy contents, run unit tests with the following flags: |
553 // out/Debug/remoting_unittests --gtest_filter=*TestRealChromotingPolicy* -v=1 | 553 // out/Debug/remoting_unittests --gtest_filter=*TestRealChromotingPolicy* -v=1 |
554 TEST_F(PolicyWatcherTest, TestRealChromotingPolicy) { | 554 TEST_F(PolicyWatcherTest, TestRealChromotingPolicy) { |
555 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 555 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
556 base::MessageLoop::current()->task_runner(); | 556 base::MessageLoop::current()->task_runner(); |
557 scoped_ptr<PolicyWatcher> policy_watcher( | 557 scoped_ptr<PolicyWatcher> policy_watcher( |
558 PolicyWatcher::Create(nullptr, task_runner)); | 558 PolicyWatcher::Create(nullptr, task_runner, task_runner)); |
559 | 559 |
560 { | 560 { |
561 base::RunLoop run_loop; | 561 base::RunLoop run_loop; |
562 policy_watcher->StartWatching(base::Bind(OnPolicyUpdatedDumpPolicy), | 562 policy_watcher->StartWatching(base::Bind(OnPolicyUpdatedDumpPolicy), |
563 base::Bind(base::DoNothing)); | 563 base::Bind(base::DoNothing)); |
564 run_loop.RunUntilIdle(); | 564 run_loop.RunUntilIdle(); |
565 } | 565 } |
566 | 566 |
567 { | 567 { |
568 base::RunLoop run_loop; | 568 base::RunLoop run_loop; |
569 PolicyWatcher* raw_policy_watcher = policy_watcher.release(); | 569 PolicyWatcher* raw_policy_watcher = policy_watcher.release(); |
570 raw_policy_watcher->StopWatching( | 570 raw_policy_watcher->StopWatching( |
571 base::Bind(base::IgnoreResult( | 571 base::Bind(base::IgnoreResult( |
572 &base::SequencedTaskRunner::DeleteSoon<PolicyWatcher>), | 572 &base::SequencedTaskRunner::DeleteSoon<PolicyWatcher>), |
573 task_runner, FROM_HERE, raw_policy_watcher)); | 573 task_runner, FROM_HERE, raw_policy_watcher)); |
574 run_loop.RunUntilIdle(); | 574 run_loop.RunUntilIdle(); |
575 } | 575 } |
576 | 576 |
577 // Today, the only verification offered by this test is: | 577 // Today, the only verification offered by this test is: |
578 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy | 578 // - Manual verification of policy values dumped by OnPolicyUpdatedDumpPolicy |
579 // - Automated verification that nothing crashed | 579 // - Automated verification that nothing crashed |
580 } | 580 } |
581 | 581 |
582 #endif | 582 #endif |
583 | 583 |
584 } // namespace policy_hack | 584 } // namespace policy_hack |
585 } // namespace remoting | 585 } // namespace remoting |
OLD | NEW |