Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/installer/util/shell_util_unittest.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | chrome/test/automation/proxy_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/installer/util/shell_util.h" 5 #include "chrome/installer/util/shell_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/base_paths_win.h" 10 #include "base/base_paths_win.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_enumerator.h"
12 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
13 #include "base/md5.h" 14 #include "base/md5.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/string16.h" 16 #include "base/string16.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/test/scoped_path_override.h" 18 #include "base/test/scoped_path_override.h"
18 #include "base/test/test_shortcut_win.h" 19 #include "base/test/test_shortcut_win.h"
19 #include "base/win/shortcut.h" 20 #include "base/win/shortcut.h"
20 #include "base/win/windows_version.h" 21 #include "base/win/windows_version.h"
21 #include "chrome/installer/util/browser_distribution.h" 22 #include "chrome/installer/util/browser_distribution.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 dist_, *test_properties_, 520 dist_, *test_properties_,
520 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 521 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
521 test_properties_->set_shortcut_name(L"A second shortcut"); 522 test_properties_->set_shortcut_name(L"A second shortcut");
522 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 523 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
523 ShellUtil::SHORTCUT_LOCATION_START_MENU, 524 ShellUtil::SHORTCUT_LOCATION_START_MENU,
524 dist_, *test_properties_, 525 dist_, *test_properties_,
525 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 526 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
526 527
527 base::FilePath shortcut_folder( 528 base::FilePath shortcut_folder(
528 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); 529 fake_start_menu_.path().Append(dist_->GetAppShortCutName()));
529 file_util::FileEnumerator file_counter(shortcut_folder, false, 530 base::FileEnumerator file_counter(shortcut_folder, false,
530 file_util::FileEnumerator::FILES); 531 base::FileEnumerator::FILES);
531 int count = 0; 532 int count = 0;
532 while (!file_counter.Next().empty()) 533 while (!file_counter.Next().empty())
533 ++count; 534 ++count;
534 EXPECT_EQ(2, count); 535 EXPECT_EQ(2, count);
535 536
536 ASSERT_TRUE(file_util::PathExists(shortcut_folder)); 537 ASSERT_TRUE(file_util::PathExists(shortcut_folder));
537 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 538 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
538 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, 539 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER,
539 chrome_exe_)); 540 chrome_exe_));
540 ASSERT_FALSE(file_util::PathExists(shortcut_folder)); 541 ASSERT_FALSE(file_util::PathExists(shortcut_folder));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 639
639 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", 640 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ",
640 L"MZXW6YTB", L"MZXW6YTBOI"}; 641 L"MZXW6YTB", L"MZXW6YTBOI"};
641 642
642 // Run the tests, with one more letter in the input every pass. 643 // Run the tests, with one more letter in the input every pass.
643 for (int i = 0; i < arraysize(expected); ++i) { 644 for (int i = 0; i < arraysize(expected); ++i) {
644 ASSERT_EQ(expected[i], 645 ASSERT_EQ(expected[i],
645 ShellUtil::ByteArrayToBase32(test_array, i)); 646 ShellUtil::ByteArrayToBase32(test_array, i));
646 } 647 }
647 } 648 }
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | chrome/test/automation/proxy_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698