OLD | NEW |
1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 The Chromium OS 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 "login_manager/child_job.h" | 5 #include "login_manager/child_job.h" |
6 | 6 |
7 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include <base/command_line.h> | 10 #include <base/command_line.h> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 std::vector<std::string> data = job.ExtractArgvForTest(); | 68 std::vector<std::string> data = job.ExtractArgvForTest(); |
69 std::vector<std::string>::const_iterator it = data.begin(); | 69 std::vector<std::string>::const_iterator it = data.begin(); |
70 for (int i = 1; i < my_argc; ++i) { | 70 for (int i = 1; i < my_argc; ++i) { |
71 EXPECT_EQ(my_argv[i], *it); | 71 EXPECT_EQ(my_argv[i], *it); |
72 ++it; | 72 ++it; |
73 } | 73 } |
74 EXPECT_TRUE(data.end() == it) << *it; | 74 EXPECT_TRUE(data.end() == it) << *it; |
75 } | 75 } |
76 | 76 |
| 77 TEST(SetUidExecJobTest, ShouldStopTest) { |
| 78 const char *my_argv[] = { "zero", |
| 79 "one", |
| 80 "two" }; |
| 81 const int my_argc = 3; |
| 82 CommandLine cl(my_argc, my_argv); |
| 83 |
| 84 SetUidExecJob job(&cl, NULL, false); |
| 85 job.RecordTime(); |
| 86 EXPECT_TRUE(job.ShouldStop()); |
| 87 } |
| 88 |
| 89 TEST(SetUidExecJobTest, ShouldNotStopTest) { |
| 90 const char *my_argv[] = { "zero", |
| 91 "one", |
| 92 "two" }; |
| 93 const int my_argc = 3; |
| 94 CommandLine cl(my_argc, my_argv); |
| 95 |
| 96 SetUidExecJob job(&cl, NULL, false); |
| 97 job.RecordTime(); |
| 98 sleep(1); |
| 99 EXPECT_FALSE(job.ShouldStop()); |
| 100 } |
| 101 |
77 } // namespace login_manager | 102 } // namespace login_manager |
OLD | NEW |