| 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/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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 L"test2", | 45 L"test2", |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // TODO(huangs): Separate this into generic shortcut tests and Chrome-specific | 48 // TODO(huangs): Separate this into generic shortcut tests and Chrome-specific |
| 49 // tests. Specifically, we should not overly rely on getting shortcut properties | 49 // tests. Specifically, we should not overly rely on getting shortcut properties |
| 50 // from product_->AddDefaultShortcutProperties(). | 50 // from product_->AddDefaultShortcutProperties(). |
| 51 class ShellUtilShortcutTest : public testing::Test { | 51 class ShellUtilShortcutTest : public testing::Test { |
| 52 protected: | 52 protected: |
| 53 ShellUtilShortcutTest() : test_properties_(ShellUtil::CURRENT_USER) {} | 53 ShellUtilShortcutTest() : test_properties_(ShellUtil::CURRENT_USER) {} |
| 54 | 54 |
| 55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() override { |
| 56 dist_ = BrowserDistribution::GetDistribution(); | 56 dist_ = BrowserDistribution::GetDistribution(); |
| 57 ASSERT_TRUE(dist_ != NULL); | 57 ASSERT_TRUE(dist_ != NULL); |
| 58 product_.reset(new installer::Product(dist_)); | 58 product_.reset(new installer::Product(dist_)); |
| 59 | 59 |
| 60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 61 chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe); | 61 chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe); |
| 62 EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); | 62 EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); |
| 63 | 63 |
| 64 manganese_exe_ = temp_dir_.path().Append(kManganeseExe); | 64 manganese_exe_ = temp_dir_.path().Append(kManganeseExe); |
| 65 EXPECT_EQ(0, base::WriteFile(manganese_exe_, "", 0)); | 65 EXPECT_EQ(0, base::WriteFile(manganese_exe_, "", 0)); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 chrome_exe_)); | 804 chrome_exe_)); |
| 805 ASSERT_TRUE(base::PathExists(shortcut_path)); | 805 ASSERT_TRUE(base::PathExists(shortcut_path)); |
| 806 ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); | 806 ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); |
| 807 } | 807 } |
| 808 | 808 |
| 809 class ShellUtilRegistryTest : public testing::Test { | 809 class ShellUtilRegistryTest : public testing::Test { |
| 810 public: | 810 public: |
| 811 ShellUtilRegistryTest() {} | 811 ShellUtilRegistryTest() {} |
| 812 | 812 |
| 813 protected: | 813 protected: |
| 814 virtual void SetUp() OVERRIDE { | 814 virtual void SetUp() override { |
| 815 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); | 815 registry_overrides_.OverrideRegistry(HKEY_CURRENT_USER); |
| 816 | 816 |
| 817 // .test2 files already have a default application. | 817 // .test2 files already have a default application. |
| 818 base::win::RegKey key; | 818 base::win::RegKey key; |
| 819 ASSERT_EQ( | 819 ASSERT_EQ( |
| 820 ERROR_SUCCESS, | 820 ERROR_SUCCESS, |
| 821 key.Create( | 821 key.Create( |
| 822 HKEY_CURRENT_USER, L"Software\\Classes\\.test2", KEY_ALL_ACCESS)); | 822 HKEY_CURRENT_USER, L"Software\\Classes\\.test2", KEY_ALL_ACCESS)); |
| 823 EXPECT_EQ(ERROR_SUCCESS, key.WriteValue(L"", L"SomeOtherApp")); | 823 EXPECT_EQ(ERROR_SUCCESS, key.WriteValue(L"", L"SomeOtherApp")); |
| 824 } | 824 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 1000 |
| 1001 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", | 1001 const base::string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", |
| 1002 L"MZXW6YTB", L"MZXW6YTBOI"}; | 1002 L"MZXW6YTB", L"MZXW6YTBOI"}; |
| 1003 | 1003 |
| 1004 // Run the tests, with one more letter in the input every pass. | 1004 // Run the tests, with one more letter in the input every pass. |
| 1005 for (int i = 0; i < arraysize(expected); ++i) { | 1005 for (int i = 0; i < arraysize(expected); ++i) { |
| 1006 ASSERT_EQ(expected[i], | 1006 ASSERT_EQ(expected[i], |
| 1007 ShellUtil::ByteArrayToBase32(test_array, i)); | 1007 ShellUtil::ByteArrayToBase32(test_array, i)); |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| OLD | NEW |