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 file_util::CreateDirectory(tmp_profile); |
Paweł Hajdan Jr.
2011/04/11 18:16:53
Could you check the return value of that? Just ASS
Mike West
2011/04/12 07:04:04
Done.
| |
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() { | 297 void TearDown() { |
Paweł Hajdan Jr.
2011/04/11 18:16:53
You can remove the entire TearDown now.
Mike West
2011/04/12 07:04:04
Done.
| |
300 UITest::TearDown(); | 298 UITest::TearDown(); |
301 EXPECT_TRUE(file_util::DieFileDie(tmp_profile_, true)); | |
302 } | 299 } |
303 | 300 |
304 public: | 301 public: |
305 FilePath tmp_profile_; | 302 ScopedTempDir temp_dir_; |
306 }; | 303 }; |
307 | 304 |
308 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) { | 305 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) { |
309 ASSERT_TRUE(LaunchAppWithProfile()); | 306 ASSERT_TRUE(LaunchAppWithProfile()); |
310 // Verify that the window is present. | 307 // Verify that the window is present. |
311 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 308 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
312 ASSERT_TRUE(browser.get()); | 309 ASSERT_TRUE(browser.get()); |
313 } | 310 } |
314 #endif // defined(OS_WIN) | 311 #endif // defined(OS_WIN) |
315 | 312 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 EXPECT_EQ(0, window_count); | 378 EXPECT_EQ(0, window_count); |
382 | 379 |
383 // Starting a browser window should work just fine. | 380 // Starting a browser window should work just fine. |
384 ASSERT_TRUE(IsBrowserRunning()); | 381 ASSERT_TRUE(IsBrowserRunning()); |
385 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); | 382 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
386 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 383 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
387 EXPECT_EQ(1, window_count); | 384 EXPECT_EQ(1, window_count); |
388 } | 385 } |
389 | 386 |
390 } // namespace | 387 } // namespace |
OLD | NEW |