OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 EXPECT_FALSE(is_visible); | 273 EXPECT_FALSE(is_visible); |
274 } | 274 } |
275 #endif // !defined(OS_MACOSX) | 275 #endif // !defined(OS_MACOSX) |
276 | 276 |
277 #if defined(OS_WIN) | 277 #if defined(OS_WIN) |
278 // This test verifies that Chrome can be launched with a user-data-dir path | 278 // This test verifies that Chrome can be launched with a user-data-dir path |
279 // which contains non ASCII characters. | 279 // which contains non ASCII characters. |
280 class LaunchBrowserWithNonAsciiUserDatadir : public UITest { | 280 class LaunchBrowserWithNonAsciiUserDatadir : public UITest { |
281 public: | 281 public: |
282 void SetUp() { | 282 void SetUp() { |
283 PathService::Get(base::DIR_TEMP, &tmp_profile_); | 283 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
284 tmp_profile_ = tmp_profile_.AppendASCII("tmp_profile"); | 284 FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile"); |
285 tmp_profile_ = tmp_profile_.Append(L"Test Chrome G�raldine"); | 285 tmp_profile = tmp_profile.Append(L"Test Chrome G�raldine"); |
286 | 286 |
287 // Create a fresh, empty copy of this directory. | 287 ASSERT_TRUE(file_util::CreateDirectory(tmp_profile)); |
288 file_util::Delete(tmp_profile_, true); | |
289 file_util::CreateDirectory(tmp_profile_); | |
290 | 288 |
291 launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile_); | 289 launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile); |
292 } | 290 } |
293 | 291 |
294 bool LaunchAppWithProfile() { | 292 bool LaunchAppWithProfile() { |
295 UITest::SetUp(); | 293 UITest::SetUp(); |
296 return true; | 294 return true; |
297 } | 295 } |
298 | 296 |
299 void TearDown() { | |
300 UITest::TearDown(); | |
301 EXPECT_TRUE(file_util::DieFileDie(tmp_profile_, true)); | |
302 } | |
303 | |
304 public: | 297 public: |
305 FilePath tmp_profile_; | 298 ScopedTempDir temp_dir_; |
306 }; | 299 }; |
307 | 300 |
308 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) { | 301 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) { |
309 ASSERT_TRUE(LaunchAppWithProfile()); | 302 ASSERT_TRUE(LaunchAppWithProfile()); |
310 // Verify that the window is present. | 303 // Verify that the window is present. |
311 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 304 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
312 ASSERT_TRUE(browser.get()); | 305 ASSERT_TRUE(browser.get()); |
313 } | 306 } |
314 #endif // defined(OS_WIN) | 307 #endif // defined(OS_WIN) |
315 | 308 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 EXPECT_EQ(0, window_count); | 374 EXPECT_EQ(0, window_count); |
382 | 375 |
383 // Starting a browser window should work just fine. | 376 // Starting a browser window should work just fine. |
384 ASSERT_TRUE(IsBrowserRunning()); | 377 ASSERT_TRUE(IsBrowserRunning()); |
385 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); | 378 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
386 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 379 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
387 EXPECT_EQ(1, window_count); | 380 EXPECT_EQ(1, window_count); |
388 } | 381 } |
389 | 382 |
390 } // namespace | 383 } // namespace |
OLD | NEW |