OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/threading/platform_thread.h" |
| 7 #include "base/time.h" |
| 8 #include "cloud_print/service/win/service_listener.h" |
| 9 #include "cloud_print/service/win/service_utils.h" |
| 10 #include "cloud_print/service/win/setup_listener.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 TEST(ServiceIpcTest, Timeout) { |
| 14 SetupListener setup(GetCurrentUserName()); |
| 15 ASSERT_FALSE(setup.WaitResponce(base::TimeDelta::FromSeconds(3))); |
| 16 } |
| 17 |
| 18 TEST(ServiceIpcTest, Sequence) { |
| 19 base::ScopedTempDir temp_dir; |
| 20 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 21 SetupListener setup(GetCurrentUserName()); |
| 22 ServiceListener service(temp_dir.path()); |
| 23 ASSERT_TRUE(setup.WaitResponce(base::TimeDelta::FromSeconds(30))); |
| 24 EXPECT_EQ(setup.user_data_dir(), temp_dir.path()); |
| 25 EXPECT_EQ(setup.user_name(), GetCurrentUserName()); |
| 26 } |
| 27 |
| 28 TEST(ServiceIpcTest, ReverseSequence) { |
| 29 base::ScopedTempDir temp_dir; |
| 30 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 31 ServiceListener service(temp_dir.path()); |
| 32 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); |
| 33 SetupListener setup(GetCurrentUserName()); |
| 34 ASSERT_TRUE(setup.WaitResponce(base::TimeDelta::FromSeconds(30))); |
| 35 EXPECT_EQ(setup.user_data_dir(), temp_dir.path()); |
| 36 EXPECT_EQ(setup.user_name(), GetCurrentUserName()); |
| 37 } |
| 38 |
| 39 TEST(ServiceIpcTest, InvaludUser) { |
| 40 base::ScopedTempDir temp_dir; |
| 41 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 42 SetupListener setup(L"guest"); |
| 43 ServiceListener service(temp_dir.path()); |
| 44 ASSERT_FALSE(setup.WaitResponce(base::TimeDelta::FromSeconds(3))); |
| 45 } |
| 46 |
OLD | NEW |