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

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

Issue 1126163003: 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: rm stdlib.h includes 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
5 #include "base/basictypes.h" 7 #include "base/basictypes.h"
6 #include "chrome/installer/mini_installer/appid.h" 8 #include "chrome/installer/mini_installer/appid.h"
7 #include "chrome/installer/mini_installer/configuration.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 using mini_installer::Configuration; 11 using mini_installer::Configuration;
11 12
12 class TestConfiguration : public Configuration { 13 class TestConfiguration : public Configuration {
13 public: 14 public:
14 explicit TestConfiguration(const wchar_t* command_line) : Configuration() { 15 explicit TestConfiguration(const wchar_t* command_line) : Configuration() {
15 Initialize(command_line); 16 Initialize(command_line);
16 } 17 }
17 private: 18 private:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count()); 51 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count());
51 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count()); 52 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count());
52 } 53 }
53 54
54 TEST(MiniInstallerConfigurationTest, CommandLine) { 55 TEST(MiniInstallerConfigurationTest, CommandLine) {
55 static const wchar_t* const kCommandLines[] = { 56 static const wchar_t* const kCommandLines[] = {
56 L"", 57 L"",
57 L"spam.exe", 58 L"spam.exe",
58 L"spam.exe --foo", 59 L"spam.exe --foo",
59 }; 60 };
60 for (size_t i = 0; i < arraysize(kCommandLines); ++i) { 61 for (const wchar_t* command_line : kCommandLines) {
61 EXPECT_TRUE(std::wstring(kCommandLines[i]) == 62 EXPECT_TRUE(std::wstring(command_line) ==
62 TestConfiguration(kCommandLines[i]).command_line()); 63 TestConfiguration(command_line).command_line());
63 } 64 }
64 } 65 }
65 66
66 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) { 67 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) {
67 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 68 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
68 TestConfiguration(L"spam.exe").chrome_app_guid()); 69 TestConfiguration(L"spam.exe").chrome_app_guid());
69 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 70 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
70 TestConfiguration(L"spam.exe --chrome").chrome_app_guid()); 71 TestConfiguration(L"spam.exe --chrome").chrome_app_guid());
71 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 72 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
72 TestConfiguration(L"spam.exe --multi-install --chrome") 73 TestConfiguration(L"spam.exe --multi-install --chrome")
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 .is_multi_install()); 110 .is_multi_install());
110 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install") 111 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install")
111 .is_multi_install()); 112 .is_multi_install());
112 } 113 }
113 114
114 TEST(MiniInstallerConfigurationTest, IsSystemLevel) { 115 TEST(MiniInstallerConfigurationTest, IsSystemLevel) {
115 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level()); 116 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level());
116 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level()); 117 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level());
117 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level()); 118 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level());
118 } 119 }
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