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.
7 #include "chrome/installer/util/wmi.h"
8 #include "testing/gtest/include/gtest/gtest.h"
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();
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();
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();
39 refs
= wmi_services
->Release();
43 // Creates an instance of cmd which executes 'echo' and exits immediately.
44 TEST(WMITest
, TestLaunchProcess
) {
46 bool result
= WMIProcess::Launch(L
"cmd.exe /c echo excelent!", &pid
);
51 } // namespace installer