Enable MSVC warning for unused locals.
[chromium-blink-merge.git] / chrome / installer / util / wmi_unittest.cc
blob163c0415afbc5de592dbcaa9ad8ff07aa58e8644
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <windows.h>
7 #include "chrome/installer/util/wmi.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace installer {
12 TEST(WMITest, TestLocalConnectionSecurityBlanket) {
13 IWbemServices* services = NULL;
14 EXPECT_TRUE(WMI::CreateLocalConnection(true, &services));
15 ASSERT_TRUE(NULL != services);
16 ULONG refs = services->Release();
17 EXPECT_EQ(refs, 0);
20 TEST(WMITest, TestLocalConnectionNoSecurityBlanket) {
21 IWbemServices* services = NULL;
22 EXPECT_TRUE(WMI::CreateLocalConnection(false, &services));
23 ASSERT_TRUE(NULL != services);
24 ULONG refs = services->Release();
25 EXPECT_EQ(refs, 0);
28 TEST(WMITest, TestCreateClassMethod) {
29 IWbemServices* wmi_services = NULL;
30 EXPECT_TRUE(WMI::CreateLocalConnection(true, &wmi_services));
31 ASSERT_TRUE(NULL != wmi_services);
32 IWbemClassObject* class_method = NULL;
33 EXPECT_TRUE(WMI::CreateClassMethodObject(wmi_services,
34 L"Win32_ShortcutFile",
35 L"Rename", &class_method));
36 ASSERT_TRUE(NULL != class_method);
37 ULONG refs = class_method->Release();
38 EXPECT_EQ(refs, 0);
39 refs = wmi_services->Release();
40 EXPECT_EQ(refs, 0);
43 // Creates an instance of cmd which executes 'echo' and exits immediately.
44 TEST(WMITest, TestLaunchProcess) {
45 int pid = 0;
46 bool result = WMIProcess::Launch(L"cmd.exe /c echo excelent!", &pid);
47 EXPECT_TRUE(result);
48 EXPECT_GT(pid, 0);
51 } // namespace installer