OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/utility_process_host.h" | 5 #include "chrome/browser/utility_process_host.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 message_loop_->Quit(); | 117 message_loop_->Quit(); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 MessageLoop* message_loop_; | 121 MessageLoop* message_loop_; |
122 NotificationRegistrar registrar_; | 122 NotificationRegistrar registrar_; |
123 int child_id_; | 123 int child_id_; |
124 bool observed_; | 124 bool observed_; |
125 }; | 125 }; |
126 | 126 |
| 127 #if !defined(OS_POSIX) |
| 128 // We should not run this on linux (crbug.com/22703) or MacOS (crbug.com/8102) |
| 129 // until problems related to autoupdate are fixed. |
127 TEST_F(UtilityProcessHostTest, ExtensionUnpacker) { | 130 TEST_F(UtilityProcessHostTest, ExtensionUnpacker) { |
128 // Copy the test extension into a temp dir and install from the temp dir. | 131 // Copy the test extension into a temp dir and install from the temp dir. |
129 FilePath extension_file; | 132 FilePath extension_file; |
130 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extension_file)); | 133 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extension_file)); |
131 extension_file = extension_file.AppendASCII("extensions") | 134 extension_file = extension_file.AppendASCII("extensions") |
132 .AppendASCII("theme.crx"); | 135 .AppendASCII("theme.crx"); |
133 FilePath temp_extension_dir; | 136 FilePath temp_extension_dir; |
134 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &temp_extension_dir)); | 137 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &temp_extension_dir)); |
135 temp_extension_dir = temp_extension_dir.AppendASCII("extension_test"); | 138 temp_extension_dir = temp_extension_dir.AppendASCII("extension_test"); |
136 ASSERT_TRUE(file_util::CreateDirectory(temp_extension_dir)); | 139 ASSERT_TRUE(file_util::CreateDirectory(temp_extension_dir)); |
137 ASSERT_TRUE(file_util::CopyFile(extension_file, | 140 ASSERT_TRUE(file_util::CopyFile(extension_file, |
138 temp_extension_dir.AppendASCII("theme.crx"))); | 141 temp_extension_dir.AppendASCII("theme.crx"))); |
139 | 142 |
140 scoped_refptr<TestUtilityProcessHostClient> client( | 143 scoped_refptr<TestUtilityProcessHostClient> client( |
141 new TestUtilityProcessHostClient(&message_loop_)); | 144 new TestUtilityProcessHostClient(&message_loop_)); |
142 ResourceDispatcherHost rdh(NULL); | 145 ResourceDispatcherHost rdh(NULL); |
143 TestUtilityProcessHost* process_host = | 146 TestUtilityProcessHost* process_host = |
144 new TestUtilityProcessHost(client.get(), &message_loop_, &rdh); | 147 new TestUtilityProcessHost(client.get(), &message_loop_, &rdh); |
145 // process_host will delete itself when it's done. | 148 // process_host will delete itself when it's done. |
146 ProcessClosedObserver observer(&message_loop_); | 149 ProcessClosedObserver observer(&message_loop_); |
147 process_host->StartExtensionUnpacker( | 150 process_host->StartExtensionUnpacker( |
148 temp_extension_dir.AppendASCII("theme.crx")); | 151 temp_extension_dir.AppendASCII("theme.crx")); |
149 observer.RunUntilClose(process_host->id()); | 152 observer.RunUntilClose(process_host->id()); |
150 EXPECT_TRUE(client->success()); | 153 EXPECT_TRUE(client->success()); |
151 | 154 |
152 // Clean up the temp dir. | 155 // Clean up the temp dir. |
153 file_util::Delete(temp_extension_dir, true); | 156 file_util::Delete(temp_extension_dir, true); |
154 } | 157 } |
| 158 #endif |
155 | 159 |
156 } // namespace | 160 } // namespace |
OLD | NEW |