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

Side by Side Diff: setup/setup_service_unittest.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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 | « setup/setup_service.h ('k') | setup/setup_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2008-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include "omaha/base/app_util.h"
17 #include "omaha/base/path.h"
18 #include "omaha/base/vistautil.h"
19 #include "omaha/setup/setup_service.h"
20 #include "omaha/testing/unit_test.h"
21
22 namespace omaha {
23
24 class SetupServiceTest : public testing::Test {
25 protected:
26 static void SetUpTestCase() {
27 // The ServiceModule has it's own ATL module. ATL does not like having
28 // multiple ATL modules. This TestCase saves and restore the original ATL
29 // module to get around ATL's limitation. This is a hack.
30 original_atl_module_ = _pAtlModule;
31 _pAtlModule = NULL;
32 }
33
34 static void TearDownTestCase() {
35 _pAtlModule = original_atl_module_;
36 }
37
38 static HRESULT DeleteUpdate3Service() {
39 return SetupUpdate3Service::DeleteService();
40 }
41
42 static HRESULT DeleteMediumService() {
43 return SetupUpdateMediumService::DeleteService();
44 }
45
46 static CAtlModule* original_atl_module_;
47 };
48
49 CAtlModule* SetupServiceTest::original_atl_module_ = NULL;
50
51 // TODO(omaha): Test SetupServiceTest
52
53 TEST_F(SetupServiceTest, InstallService_FileDoesNotExist) {
54 if (!vista_util::IsUserAdmin()) {
55 std::wcout << _T("\tTest did not run because the user is not an admin.")
56 << std::endl;
57 return;
58 }
59
60 DeleteUpdate3Service();
61 DeleteMediumService();
62
63 CString service_path = ConcatenatePath(app_util::GetCurrentModuleDirectory(),
64 _T("NoSuchFile.exe"));
65
66 // The Windows service registration APIs do not rely on the file existing.
67 EXPECT_SUCCEEDED(
68 SetupUpdate3Service::InstallService(service_path));
69
70 EXPECT_SUCCEEDED(
71 SetupUpdateMediumService::InstallService(service_path));
72
73 EXPECT_SUCCEEDED(DeleteUpdate3Service());
74 EXPECT_SUCCEEDED(DeleteMediumService());
75 }
76
77 } // namespace omaha
OLDNEW
« no previous file with comments | « setup/setup_service.h ('k') | setup/setup_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698