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

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: review 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
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 <stdlib.h>
grt (UTC plus 2) 2015/05/06 18:10:15 is this needed now?
tfarina 2015/05/06 18:16:07 Done.
8
5 #include "base/basictypes.h" 9 #include "base/basictypes.h"
6 #include "chrome/installer/mini_installer/appid.h" 10 #include "chrome/installer/mini_installer/appid.h"
7 #include "chrome/installer/mini_installer/configuration.h"
8 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
9 12
10 using mini_installer::Configuration; 13 using mini_installer::Configuration;
11 14
12 class TestConfiguration : public Configuration { 15 class TestConfiguration : public Configuration {
13 public: 16 public:
14 explicit TestConfiguration(const wchar_t* command_line) : Configuration() { 17 explicit TestConfiguration(const wchar_t* command_line) : Configuration() {
15 Initialize(command_line); 18 Initialize(command_line);
16 } 19 }
17 private: 20 private:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count()); 53 EXPECT_EQ(2, TestConfiguration(L"spam.exe --foo").argument_count());
51 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count()); 54 EXPECT_EQ(3, TestConfiguration(L"spam.exe --foo --bar").argument_count());
52 } 55 }
53 56
54 TEST(MiniInstallerConfigurationTest, CommandLine) { 57 TEST(MiniInstallerConfigurationTest, CommandLine) {
55 static const wchar_t* const kCommandLines[] = { 58 static const wchar_t* const kCommandLines[] = {
56 L"", 59 L"",
57 L"spam.exe", 60 L"spam.exe",
58 L"spam.exe --foo", 61 L"spam.exe --foo",
59 }; 62 };
60 for (size_t i = 0; i < arraysize(kCommandLines); ++i) { 63 for (const wchar_t* command_line : kCommandLines) {
61 EXPECT_TRUE(std::wstring(kCommandLines[i]) == 64 EXPECT_TRUE(std::wstring(command_line) ==
62 TestConfiguration(kCommandLines[i]).command_line()); 65 TestConfiguration(command_line).command_line());
63 } 66 }
64 } 67 }
65 68
66 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) { 69 TEST(MiniInstallerConfigurationTest, ChromeAppGuid) {
67 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 70 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
68 TestConfiguration(L"spam.exe").chrome_app_guid()); 71 TestConfiguration(L"spam.exe").chrome_app_guid());
69 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 72 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
70 TestConfiguration(L"spam.exe --chrome").chrome_app_guid()); 73 TestConfiguration(L"spam.exe --chrome").chrome_app_guid());
71 EXPECT_TRUE(std::wstring(google_update::kAppGuid) == 74 EXPECT_TRUE(std::wstring(google_update::kAppGuid) ==
72 TestConfiguration(L"spam.exe --multi-install --chrome") 75 TestConfiguration(L"spam.exe --multi-install --chrome")
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 .is_multi_install()); 112 .is_multi_install());
110 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install") 113 EXPECT_TRUE(TestConfiguration(L"spam.exe --multi-install")
111 .is_multi_install()); 114 .is_multi_install());
112 } 115 }
113 116
114 TEST(MiniInstallerConfigurationTest, IsSystemLevel) { 117 TEST(MiniInstallerConfigurationTest, IsSystemLevel) {
115 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level()); 118 EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level());
116 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level()); 119 EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level());
117 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level()); 120 EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level());
118 } 121 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/mini_installer/decompress.h » ('j') | chrome/installer/mini_installer/decompress.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698