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

Side by Side Diff: chrome/installer/mini_installer/configuration_test.cc

Issue 1133613002: Revert of mini_installer: Change to use _countof rather than base's arraysize macro. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | chrome/installer/mini_installer/decompress.h » ('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) 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 "chrome/installer/mini_installer/configuration.h"
6
7 #include "base/basictypes.h" 5 #include "base/basictypes.h"
8 #include "chrome/installer/mini_installer/appid.h" 6 #include "chrome/installer/mini_installer/appid.h"
7 #include "chrome/installer/mini_installer/configuration.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 using mini_installer::Configuration; 10 using mini_installer::Configuration;
12 11
13 class TestConfiguration : public Configuration { 12 class TestConfiguration : public Configuration {
14 public: 13 public:
15 explicit TestConfiguration(const wchar_t* command_line) : Configuration() { 14 explicit TestConfiguration(const wchar_t* command_line) : Configuration() {
16 Initialize(command_line); 15 Initialize(command_line);
17 } 16 }
18 private: 17 private:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count()); 50 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count());
52 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count()); 51 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count());
53 } 52 }
54 53
55 TEST(MiniInstallerConfigurationTest, CommandLine) { 54 TEST(MiniInstallerConfigurationTest, CommandLine) {
56 static const wchar_t* const kCommandLines[] = { 55 static const wchar_t* const kCommandLines[] = {
57 L"", 56 L"",
58 L"spam.exe", 57 L"spam.exe",
59 L"spam.exe --foo", 58 L"spam.exe --foo",
60 }; 59 };
61 for (const wchar_t* command_line : kCommandLines) { 60 for (size_t i = 0; i < arraysize(kCommandLines); ++i) {
62 EXPECT_TRUE(std::wstring(command_line) == 61 EXPECT_TRUE(std::wstring(kCommandLines[i]) ==
63 TestConfiguration(command_line).command_line()); 62 TestConfiguration(kCommandLines[i]).command_line());
64 } 63 }
65 } 64 }
66 65
67 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) { 66 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) {
68 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 67 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
69 TestConfiguration(L"spam.exe").chrome_app_guid()); 68 TestConfiguration(L"spam.exe").chrome_app_guid());
70 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 69 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
71 TestConfiguration(L"spam.exe --chrome").chrome_app_guid()); 70 TestConfiguration(L"spam.exe --chrome").chrome_app_guid());
72 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 71 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
73 TestConfiguration(L"spam.exe --multi-install --chrome") 72 TestConfiguration(L"spam.exe --multi-install --chrome")
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 .is_multi_install()); 109 .is_multi_install());
111 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install") 110 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install")
112 .is_multi_install()); 111 .is_multi_install());
113 } 112 }
114 113
115 TEST(MiniInstallerConfigurationTest, IsSystemLevel) { 114 TEST(MiniInstallerConfigurationTest, IsSystemLevel) {
116 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level()); 115 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level());
117 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level()); 116 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level());
118 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level()); 117 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level());
119 } 118 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/mini_installer/decompress.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698