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

Side by Side Diff: ceee/ie/common/ceee_module_util_unittest.cc

Issue 5027001: Add the Chrome version as one of the things we check to see if... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Unit tests for the CEEE module-wide utilities. 5 // Unit tests for the CEEE module-wide utilities.
6 6
7 #include "ceee/ie/common/ceee_module_util.h" 7 #include "ceee/ie/common/ceee_module_util.h"
8 8
9 #include <wtypes.h> 9 #include <wtypes.h>
10 #include <string> 10 #include <string>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/win/registry.h" 16 #include "base/win/registry.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "ceee/common/process_utils_win.h" 18 #include "ceee/common/process_utils_win.h"
19 #include "ceee/ie/testing/mock_broker_and_friends.h" 19 #include "ceee/ie/testing/mock_broker_and_friends.h"
20 #include "ceee/testing/utils/mock_com.h" 20 #include "ceee/testing/utils/mock_com.h"
21 #include "ceee/testing/utils/mock_window_utils.h" 21 #include "ceee/testing/utils/mock_window_utils.h"
22 #include "ceee/testing/utils/mock_win32.h" 22 #include "ceee/testing/utils/mock_win32.h"
23 #include "ceee/testing/utils/test_utils.h" 23 #include "ceee/testing/utils/test_utils.h"
24 #include "chrome/installer/util/google_update_constants.h" 24 #include "chrome/installer/util/google_update_constants.h"
25 #include "testing/gmock/include/gmock/gmock.h" 25 #include "gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "gtest/gtest.h"
27 27
28 namespace { 28 namespace {
29 29
30 using testing::_; 30 using testing::_;
31 using testing::DoAll; 31 using testing::DoAll;
32 using testing::NotNull; 32 using testing::NotNull;
33 using testing::SetArgumentPointee; 33 using testing::SetArgumentPointee;
34 using testing::StrictMock; 34 using testing::StrictMock;
35 using testing::Return; 35 using testing::Return;
36 36
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(full_path, &temp_file_path)); 123 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(full_path, &temp_file_path));
124 ASSERT_TRUE(file_util::Move(temp_file_path, crx_path)); 124 ASSERT_TRUE(file_util::Move(temp_file_path, crx_path));
125 EXPECT_CALL(mock_path, Get(base::DIR_PROGRAM_FILES, NotNull())). 125 EXPECT_CALL(mock_path, Get(base::DIR_PROGRAM_FILES, NotNull())).
126 WillOnce(DoAll(SetArgumentPointee<1>(temp_path), Return(true))); 126 WillOnce(DoAll(SetArgumentPointee<1>(temp_path), Return(true)));
127 EXPECT_EQ(crx_path.value(), cmu::GetExtensionPath()); 127 EXPECT_EQ(crx_path.value(), cmu::GetExtensionPath());
128 128
129 // Clean up. 129 // Clean up.
130 file_util::Delete(temp_path, true); 130 file_util::Delete(temp_path, true);
131 } 131 }
132 132
133 TEST_F(CeeeModuleUtilTest, ExtensionPathTest) { 133 // http://code.google.com/p/chromium/issues/detail?id=62856
134 TEST_F(CeeeModuleUtilTest, FLAKY_ExtensionPathTest) {
134 namespace cmu = ceee_module_util; 135 namespace cmu = ceee_module_util;
135 136
136 // The FilePath::Get method shouldn't be called if we take the value 137 // The FilePath::Get method shouldn't be called if we take the value
137 // from the registry. 138 // from the registry.
138 StrictMock<MockPathService> mock_path; 139 StrictMock<MockPathService> mock_path;
139 140
140 // Creates a registry key 141 // Creates a registry key
141 base::win::RegKey hkcu(HKEY_CURRENT_USER, L"SOFTWARE\\Google\\CEEE", 142 base::win::RegKey hkcu(HKEY_CURRENT_USER, L"SOFTWARE\\Google\\CEEE",
142 KEY_WRITE); 143 KEY_WRITE);
143 base::win::RegKey hklm(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Google\\CEEE", 144 base::win::RegKey hklm(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Google\\CEEE",
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ASSERT_TRUE(ceee_module_util::GetCollectStatsConsent()); 279 ASSERT_TRUE(ceee_module_util::GetCollectStatsConsent());
279 280
280 ASSERT_TRUE(hkcu.WriteValue(google_update::kRegUsageStatsField, kFalse)); 281 ASSERT_TRUE(hkcu.WriteValue(google_update::kRegUsageStatsField, kFalse));
281 EXPECT_FALSE(ceee_module_util::GetCollectStatsConsent()); 282 EXPECT_FALSE(ceee_module_util::GetCollectStatsConsent());
282 283
283 ASSERT_TRUE(hkcu.DeleteValue(google_update::kRegUsageStatsField)); 284 ASSERT_TRUE(hkcu.DeleteValue(google_update::kRegUsageStatsField));
284 ASSERT_TRUE(hklm.DeleteValue(google_update::kRegUsageStatsField)); 285 ASSERT_TRUE(hklm.DeleteValue(google_update::kRegUsageStatsField));
285 } 286 }
286 287
287 } // namespace 288 } // namespace
OLDNEW
« ceee/ie/common/ceee_module_util.cc ('K') | « ceee/ie/common/ceee_module_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698