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/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.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/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/process/kill.h" | 12 #include "base/process/kill.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 | 16 |
17 #if !defined(OS_MACOSX) | 17 #if !defined(OS_MACOSX) |
18 #include "base/at_exit.h" | 18 #include "base/at_exit.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/test/multiprocess_test.h" | 22 #include "base/test/multiprocess_test.h" |
23 #include "base/test/test_timeouts.h" | 23 #include "base/test/test_timeouts.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/chrome_version_info.h" | 26 #include "components/version_info/version_info.h" |
27 #include "testing/multiprocess_func_list.h" | 27 #include "testing/multiprocess_func_list.h" |
28 | 28 |
29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
30 #include "base/win/win_util.h" | 30 #include "base/win/win_util.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(OS_POSIX) | 33 #if defined(OS_POSIX) |
34 #include "chrome/common/auto_start_linux.h" | 34 #include "chrome/common/auto_start_linux.h" |
35 #endif | 35 #endif |
36 | 36 |
(...skipping 18 matching lines...) Expand all Loading... |
55 ASSERT_FALSE(g_good_shutdown); | 55 ASSERT_FALSE(g_good_shutdown); |
56 g_good_shutdown = true; | 56 g_good_shutdown = true; |
57 loop->task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); | 57 loop->task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 TEST(ServiceProcessUtilTest, ScopedVersionedName) { | 62 TEST(ServiceProcessUtilTest, ScopedVersionedName) { |
63 std::string test_str = "test"; | 63 std::string test_str = "test"; |
64 std::string scoped_name = GetServiceProcessScopedVersionedName(test_str); | 64 std::string scoped_name = GetServiceProcessScopedVersionedName(test_str); |
65 chrome::VersionInfo version_info; | |
66 EXPECT_TRUE(base::EndsWith(scoped_name, test_str, | 65 EXPECT_TRUE(base::EndsWith(scoped_name, test_str, |
67 base::CompareCase::SENSITIVE)); | 66 base::CompareCase::SENSITIVE)); |
68 EXPECT_NE(std::string::npos, scoped_name.find(version_info.Version())); | 67 EXPECT_NE(std::string::npos, |
| 68 scoped_name.find(version_info::GetVersionNumber())); |
69 } | 69 } |
70 | 70 |
71 class ServiceProcessStateTest : public base::MultiProcessTest { | 71 class ServiceProcessStateTest : public base::MultiProcessTest { |
72 public: | 72 public: |
73 ServiceProcessStateTest(); | 73 ServiceProcessStateTest(); |
74 ~ServiceProcessStateTest() override; | 74 ~ServiceProcessStateTest() override; |
75 void SetUp() override; | 75 void SetUp() override; |
76 base::SingleThreadTaskRunner* IOMessageLoopProxy() { | 76 base::SingleThreadTaskRunner* IOMessageLoopProxy() { |
77 return io_thread_.task_runner().get(); | 77 return io_thread_.task_runner().get(); |
78 } | 78 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ScopedAttributesRestorer restorer(bundle_path(), 0777); | 418 ScopedAttributesRestorer restorer(bundle_path(), 0777); |
419 GetIOMessageLoopProxy()->PostTask( | 419 GetIOMessageLoopProxy()->PostTask( |
420 FROM_HERE, | 420 FROM_HERE, |
421 base::Bind(&ChangeAttr, bundle_path(), 0222)); | 421 base::Bind(&ChangeAttr, bundle_path(), 0222)); |
422 Run(); | 422 Run(); |
423 ASSERT_TRUE(mock_launchd()->remove_called()); | 423 ASSERT_TRUE(mock_launchd()->remove_called()); |
424 ASSERT_TRUE(mock_launchd()->delete_called()); | 424 ASSERT_TRUE(mock_launchd()->delete_called()); |
425 } | 425 } |
426 | 426 |
427 #endif // !OS_MACOSX | 427 #endif // !OS_MACOSX |
OLD | NEW |