| 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 "chrome/browser/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 "}"; | 107 "}"; |
| 108 | 108 |
| 109 const char kDMServer[] = "http://server/device_management"; | 109 const char kDMServer[] = "http://server/device_management"; |
| 110 const char kDMRegisterRequest[] = | 110 const char kDMRegisterRequest[] = |
| 111 "http://server/device_management?request=register"; | 111 "http://server/device_management?request=register"; |
| 112 const char kDMPolicyRequest[] = | 112 const char kDMPolicyRequest[] = |
| 113 "http://server/device_management?request=policy"; | 113 "http://server/device_management?request=policy"; |
| 114 | 114 |
| 115 const char kDMToken[] = "1234"; | 115 const char kDMToken[] = "1234"; |
| 116 | 116 |
| 117 // Used to mark |flag|, indicating that RefreshPolicies() has executed its | |
| 118 // callback. | |
| 119 void SetFlag(bool* flag) { | |
| 120 *flag = true; | |
| 121 } | |
| 122 | |
| 123 // Single task of the fake IO loop used in the test, that just waits until | 117 // Single task of the fake IO loop used in the test, that just waits until |
| 124 // it is signaled to quit or perform some work. | 118 // it is signaled to quit or perform some work. |
| 125 // |completion| is the event to wait for, and |work| is the task to invoke | 119 // |completion| is the event to wait for, and |work| is the task to invoke |
| 126 // when signaled. If the task returns false then this quits the IO loop. | 120 // when signaled. If the task returns false then this quits the IO loop. |
| 127 void BlockLoop(base::WaitableEvent* completion, base::Callback<bool()> work) { | 121 void BlockLoop(base::WaitableEvent* completion, base::Callback<bool()> work) { |
| 128 do { | 122 do { |
| 129 completion->Wait(); | 123 completion->Wait(); |
| 130 } while (work.Run()); | 124 } while (work.Run()); |
| 131 base::MessageLoop::current()->QuitNow(); | 125 base::MessageLoop::current()->QuitNow(); |
| 132 } | 126 } |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 664 } |
| 671 | 665 |
| 672 INSTANTIATE_TEST_CASE_P( | 666 INSTANTIATE_TEST_CASE_P( |
| 673 LoginUtilsBlockingLoginTestInstance, | 667 LoginUtilsBlockingLoginTestInstance, |
| 674 LoginUtilsBlockingLoginTest, | 668 LoginUtilsBlockingLoginTest, |
| 675 testing::Values(0, 1, 2, 3, 4, 5)); | 669 testing::Values(0, 1, 2, 3, 4, 5)); |
| 676 | 670 |
| 677 } // namespace | 671 } // namespace |
| 678 | 672 |
| 679 } // namespace chromeos | 673 } // namespace chromeos |
| OLD | NEW |