diff options
67 files changed, 284 insertions, 292 deletions
diff --git a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc index f350b44..087b350 100644 --- a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc +++ b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc @@ -1031,10 +1031,10 @@ TEST_F(InMemoryURLIndexTest, ReadVisitsFromHistory) { ASSERT_TRUE(entry != history_info_map.end()); { const VisitInfoVector& visits = entry->second.visits; - EXPECT_EQ(3u, visits.size()); - EXPECT_EQ(0u, visits[0].second); - EXPECT_EQ(1u, visits[1].second); - EXPECT_EQ(0u, visits[2].second); + ASSERT_EQ(3u, visits.size()); + EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[0].second); + EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[1].second); + EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[2].second); } // Ditto but for URL with id 35. @@ -1042,9 +1042,9 @@ TEST_F(InMemoryURLIndexTest, ReadVisitsFromHistory) { ASSERT_TRUE(entry != history_info_map.end()); { const VisitInfoVector& visits = entry->second.visits; - EXPECT_EQ(2u, visits.size()); - EXPECT_EQ(1u, visits[0].second); - EXPECT_EQ(1u, visits[1].second); + ASSERT_EQ(2u, visits.size()); + EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[0].second); + EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[1].second); } // The URL with id 32 has many visits listed in the database, but we @@ -1055,7 +1055,7 @@ TEST_F(InMemoryURLIndexTest, ReadVisitsFromHistory) { const VisitInfoVector& visits = entry->second.visits; EXPECT_EQ(10u, visits.size()); for (size_t i = 0; i < visits.size(); ++i) - EXPECT_EQ(0u, visits[i].second); + EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[i].second); } } diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index 800d726..7bf6aa8 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc @@ -246,11 +246,11 @@ class TestObserver : public ProfileWriter, EXPECT_EQ(arraysize(kIEFaviconGroup), favicon_count_); } if (importer_items_ & importer::HISTORY) - EXPECT_EQ(2, history_count_); + EXPECT_EQ(2u, history_count_); if (importer_items_ & importer::HOME_PAGE) - EXPECT_EQ(1, homepage_count_); + EXPECT_EQ(1u, homepage_count_); if ((importer_items_ & importer::PASSWORDS) && (ie_version_ == IE7)) - EXPECT_EQ(1, ie7_password_count_); + EXPECT_EQ(1u, ie7_password_count_); // We need to test the IE6 password importer code. // https://crbug.com/257100 // EXPECT_EQ(1, password_count_); @@ -352,7 +352,7 @@ class TestObserver : public ProfileWriter, if (ie_version_ == IE7) { EXPECT_EQ(L"Test1", info.url_hash); EXPECT_EQ(1, info.encrypted_data[0]); - EXPECT_EQ(4, info.encrypted_data.size()); + EXPECT_EQ(4u, info.encrypted_data.size()); ++ie7_password_count_; } } diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc index 9155830..f023ae3 100644 --- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc +++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc @@ -61,7 +61,7 @@ class ITunesFinderWinTest : public InProcessBrowserTest { base::FilePath pref_dir = app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); ASSERT_TRUE(base::CreateDirectory(pref_dir)); - ASSERT_EQ(data.size(), + ASSERT_EQ(static_cast<int>(data.size()), base::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), data.data(), data.size())); } diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc index 38f3c87..48503ee 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc @@ -167,7 +167,7 @@ TEST_F(MTPDeviceDelegateImplWinTest, GalleryNameMTP) { base::Bind(&GetGalleryInfoCallback, base::Unretained(&results))); base::RunLoop().RunUntilIdle(); - ASSERT_EQ(media_directories_.num_galleries() + 1, results.size()); + ASSERT_EQ(media_directories_.num_galleries() + 1u, results.size()); bool checked = false; for (FSInfoMap::iterator i = results.begin(); i != results.end(); ++i) { MediaFileSystemInfo info = i->second; diff --git a/chrome/browser/password_manager/password_manager_util_win.cc b/chrome/browser/password_manager/password_manager_util_win.cc index b056780..cc5371f 100644 --- a/chrome/browser/password_manager/password_manager_util_win.cc +++ b/chrome/browser/password_manager/password_manager_util_win.cc @@ -235,7 +235,7 @@ bool AuthenticateUser(gfx::NativeWindow window) { base::string16 password_prompt = l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT); HANDLE handle = INVALID_HANDLE_VALUE; - int tries = 0; + size_t tries = 0; bool use_displayname = false; bool use_principalname = false; DWORD logon_result = 0; diff --git a/chrome/browser/private_working_set_snapshot_win.cc b/chrome/browser/private_working_set_snapshot_win.cc index bd31dc7..0a0303a 100644 --- a/chrome/browser/private_working_set_snapshot_win.cc +++ b/chrome/browser/private_working_set_snapshot_win.cc @@ -115,9 +115,9 @@ void PrivateWorkingSetSnapshot::Sample() { DWORD buffer_size1 = 0; DWORD item_count1 = 0; // Process IDs should be retrieved as PDH_FMT_LONG - if (PdhGetFormattedCounterArray(counter_pair.process_id_handle, - PDH_FMT_LONG, &buffer_size1, &item_count1, - nullptr) != PDH_MORE_DATA) + if (PdhGetFormattedCounterArray( + counter_pair.process_id_handle, PDH_FMT_LONG, &buffer_size1, + &item_count1, nullptr) != static_cast<PDH_STATUS>(PDH_MORE_DATA)) continue; if (buffer_size1 == 0 || item_count1 == 0) continue; @@ -128,9 +128,9 @@ void PrivateWorkingSetSnapshot::Sample() { // Note that if this second call to PdhGetFormattedCounterArray with the // buffer size and count variables being zero is omitted then the PID and // working-set results are not reliably correlated. - if (PdhGetFormattedCounterArray(counter_pair.private_ws_handle, - PDH_FMT_LARGE, &buffer_size2, &item_count2, - nullptr) != PDH_MORE_DATA) + if (PdhGetFormattedCounterArray( + counter_pair.private_ws_handle, PDH_FMT_LARGE, &buffer_size2, + &item_count2, nullptr) != static_cast<PDH_STATUS>(PDH_MORE_DATA)) continue; // It is not clear whether Pdh guarantees that the two counters in the same diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 44b0f91..644a883 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -63,8 +63,8 @@ class ProfileShortcutManagerTest : public testing::Test { message_loop_.RunUntilIdle(); // Delete all profiles and ensure their shortcuts got removed. - const int num_profiles = profile_info_cache_->GetNumberOfProfiles(); - for (int i = 0; i < num_profiles; ++i) { + const size_t num_profiles = profile_info_cache_->GetNumberOfProfiles(); + for (size_t i = 0; i < num_profiles; ++i) { const base::FilePath profile_path = profile_info_cache_->GetPathOfProfileAtIndex(0); base::string16 profile_name = @@ -93,7 +93,7 @@ class ProfileShortcutManagerTest : public testing::Test { } void SetupDefaultProfileShortcut(const tracked_objects::Location& location) { - ASSERT_EQ(0, profile_info_cache_->GetNumberOfProfiles()) + ASSERT_EQ(0u, profile_info_cache_->GetNumberOfProfiles()) << location.ToString(); ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)) << location.ToString(); diff --git a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc index b15549e..8e2ce06 100644 --- a/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/blacklist_load_analyzer_win_unittest.cc @@ -42,7 +42,7 @@ TEST(BlacklistLoadAnalyzer, TestBlacklistBypass) { // Check that the test dll appears in list. module_names.clear(); EXPECT_TRUE(GetLoadedBlacklistedModules(&module_names)); - ASSERT_EQ(1, module_names.size()); + ASSERT_EQ(1u, module_names.size()); EXPECT_STREQ(kTestDllName, base::ToLowerASCII( base::FilePath(module_names[0]).BaseName().value()).c_str()); diff --git a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc index 6097649..05c5f53 100644 --- a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc @@ -193,7 +193,7 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, VerifyLoadedModules) { reinterpret_cast<void*>(&new_val), 1, &bytes_written); - ASSERT_EQ(1, bytes_written); + ASSERT_EQ(1u, bytes_written); ClientIncidentReport_EnvironmentData_Process process_report; CollectModuleVerificationData(kTestDllNames, kTestDllNamesCount, @@ -258,13 +258,14 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectRegistryData) { CollectRegistryData(kRegKeysToCollect, 1, ®istry_data_pb); // Expect 1 registry key, 1 value. - EXPECT_EQ(1U, registry_data_pb.size()); + EXPECT_EQ(1, registry_data_pb.size()); EXPECT_EQ("HKEY_CURRENT_USER\\Software\\TestKey", registry_data_pb.Get(0).name()); - EXPECT_EQ(1U, registry_data_pb.Get(0).value_size()); + EXPECT_EQ(1, registry_data_pb.Get(0).value_size()); EXPECT_EQ(base::WideToUTF8(kStringValueName), registry_data_pb.Get(0).value(0).name()); - EXPECT_EQ(REG_SZ, registry_data_pb.Get(0).value(0).type()); + EXPECT_EQ(static_cast<uint32_t>(REG_SZ), + registry_data_pb.Get(0).value(0).type()); const char* value_data = registry_data_pb.Get(0).value(0).data().c_str(); EXPECT_EQ(kStringData, std::wstring(reinterpret_cast<const wchar_t*>(&value_data[0]))); @@ -276,8 +277,8 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectRegistryData) { CollectRegistryData(kRegKeysToCollect, 1, ®istry_data_pb); // Expect 1 registry key, 2 values. - EXPECT_EQ(1U, registry_data_pb.size()); - EXPECT_EQ(2U, registry_data_pb.Get(0).value_size()); + EXPECT_EQ(1, registry_data_pb.size()); + EXPECT_EQ(2, registry_data_pb.Get(0).value_size()); // Add a subkey. const wchar_t kTestValueName[] = L"TestValue"; @@ -293,16 +294,16 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectRegistryData) { CollectRegistryData(kRegKeysToCollect, 1, ®istry_data_pb); // Expect 1 subkey, 1 value. - EXPECT_EQ(1U, registry_data_pb.Get(0).key_size()); + EXPECT_EQ(1, registry_data_pb.Get(0).key_size()); const ClientIncidentReport_EnvironmentData_OS_RegistryKey& subkey_pb = registry_data_pb.Get(0).key(0); EXPECT_EQ(base::WideToUTF8(kSubKey), subkey_pb.name()); - EXPECT_EQ(1U, subkey_pb.value_size()); + EXPECT_EQ(1, subkey_pb.value_size()); EXPECT_EQ(base::WideToUTF8(kTestValueName), subkey_pb.value(0).name()); value_data = subkey_pb.value(0).data().c_str(); EXPECT_EQ(kTestData, std::wstring(reinterpret_cast<const wchar_t*>(&value_data[0]))); - EXPECT_EQ(REG_SZ, subkey_pb.value(0).type()); + EXPECT_EQ(static_cast<uint32_t>(REG_SZ), subkey_pb.value(0).type()); } TEST(SafeBrowsingEnvironmentDataCollectionWinTest, diff --git a/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc index 8f79a69..62b74db 100644 --- a/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc @@ -250,7 +250,7 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, &disk_code_addr, &code_size)); - const size_t kModificationSize = 256; + const int kModificationSize = 256; // Write the modification at the end so it's not overlapping relocations const size_t modification_offset = code_size - kModificationSize; ScopedModuleModifier<kModificationSize> mod( @@ -299,7 +299,7 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, DISABLED_VerifyModuleRelocOverlap) { &code_size)); // Modify the first hunk of the code, which contains many relocs. - const size_t kModificationSize = 256; + const int kModificationSize = 256; ScopedModuleModifier<kModificationSize> mod(mem_code_addr); state.Clear(); @@ -314,7 +314,8 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, DISABLED_VerifyModuleRelocOverlap) { // Modifications across the relocs should have been coalesced into one. ASSERT_EQ(1, state.modification_size()); ASSERT_EQ(kModificationSize, state.modification(0).byte_count()); - ASSERT_EQ(kModificationSize, state.modification(0).modified_bytes().size()); + ASSERT_EQ(static_cast<size_t>(kModificationSize), + state.modification(0).modified_bytes().size()); EXPECT_EQ(std::string(mem_code_addr, mem_code_addr + kModificationSize), state.modification(0).modified_bytes()); } diff --git a/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc index 5a35414..bf00f7d 100644 --- a/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc @@ -99,7 +99,7 @@ class PlatformStateStoreWinTest : public ::testing::Test { ASSERT_EQ(ERROR_SUCCESS, key.ReadValue(base::UTF8ToUTF16(kProfileName_).c_str(), &buffer[0], &data_size, &data_type)); - EXPECT_EQ(REG_BINARY, data_type); + EXPECT_EQ(static_cast<DWORD>(REG_BINARY), data_type); ASSERT_EQ(kTestDataSize_, data_size); EXPECT_EQ(std::string(&buffer[0], data_size), std::string(&kTestData_[0], kTestDataSize_)); diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 5de8cf5..6ed09cf 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -165,7 +165,7 @@ void MigrateChromiumShortcutsCallback() { } }; - for (int i = 0; i < arraysize(kLocations); ++i) { + for (size_t i = 0; i < arraysize(kLocations); ++i) { base::FilePath path; if (!PathService::Get(kLocations[i].location_id, &path)) { NOTREACHED(); diff --git a/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc b/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc index 71c57a3..d1a9795 100644 --- a/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc +++ b/chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc @@ -238,11 +238,11 @@ IN_PROC_BROWSER_TEST_F(NavigationAccessibilityTest, << " name=" << name; // We should get only focus events. - EXPECT_EQ(EVENT_OBJECT_FOCUS, event); + EXPECT_EQ(static_cast<DWORD>(EVENT_OBJECT_FOCUS), event); // We should get only focus events on document objects. (On a page with // JavaScript or autofocus, additional focus events would be expected.) - EXPECT_EQ(ROLE_SYSTEM_DOCUMENT, role); + EXPECT_EQ(static_cast<DWORD>(ROLE_SYSTEM_DOCUMENT), role); // We shouldn't get any events on the first page because from the time // we start monitoring, the user has already initiated a load to the diff --git a/chrome/browser/web_applications/update_shortcut_worker_win.cc b/chrome/browser/web_applications/update_shortcut_worker_win.cc index 09b0051..26810eb 100644 --- a/chrome/browser/web_applications/update_shortcut_worker_win.cc +++ b/chrome/browser/web_applications/update_shortcut_worker_win.cc @@ -154,7 +154,7 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { } }; - for (int i = 0; i < arraysize(locations); ++i) { + for (size_t i = 0; i < arraysize(locations); ++i) { base::FilePath path; if (!PathService::Get(locations[i].location_id, &path)) { NOTREACHED(); diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 18772be..86e5a0e 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -590,7 +590,7 @@ std::vector<base::FilePath> GetShortcutPaths( BrowserDistribution* dist = BrowserDistribution::GetDistribution(); // Populate shortcut_paths. - for (int i = 0; i < arraysize(locations); ++i) { + for (size_t i = 0; i < arraysize(locations); ++i) { if (locations[i].use_this_location) { base::FilePath path; if (!ShellUtil::GetShortcutPath(locations[i].location_id, diff --git a/chrome/child/pdf_child_init.cc b/chrome/child/pdf_child_init.cc index fe9a1a4..4c32753 100644 --- a/chrome/child/pdf_child_init.cc +++ b/chrome/child/pdf_child_init.cc @@ -43,7 +43,7 @@ DWORD WINAPI GetFontDataPatch(HDC hdc, DWORD offset, LPVOID buffer, DWORD length) { - int rv = g_original_get_font_data(hdc, table, offset, buffer, length); + DWORD rv = g_original_get_font_data(hdc, table, offset, buffer, length); if (rv == GDI_ERROR && hdc) { HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); diff --git a/chrome/common/importer/firefox_importer_utils_win.cc b/chrome/common/importer/firefox_importer_utils_win.cc index 7cfbc50..47486d1 100644 --- a/chrome/common/importer/firefox_importer_utils_win.cc +++ b/chrome/common/importer/firefox_importer_utils_win.cc @@ -32,9 +32,8 @@ int GetCurrentFirefoxMajorVersionFromRegistry() { // When installing Firefox with admin account, the product keys will be // written under HKLM\Mozilla. Otherwise it the keys will be written under // HKCU\Mozilla. - for (int i = 0; i < arraysize(kFireFoxRegistryPaths); ++i) { - base::win::RegKey reg_key(kFireFoxRegistryPaths[i], kFirefoxPath, - KEY_READ); + for (const HKEY kFireFoxRegistryPath : kFireFoxRegistryPaths) { + base::win::RegKey reg_key(kFireFoxRegistryPath, kFirefoxPath, KEY_READ); LONG result = reg_key.ReadValue(kCurrentVersion, ver_buffer, &ver_buffer_length, NULL); diff --git a/chrome/common/safe_browsing/binary_feature_extractor_win_unittest.cc b/chrome/common/safe_browsing/binary_feature_extractor_win_unittest.cc index f050c0d..cf878e8 100644 --- a/chrome/common/safe_browsing/binary_feature_extractor_win_unittest.cc +++ b/chrome/common/safe_browsing/binary_feature_extractor_win_unittest.cc @@ -56,7 +56,7 @@ TEST_F(BinaryFeatureExtractorWinTest, UntrustedSignedBinary) { ASSERT_EQ(1, signature_info.certificate_chain_size()); std::vector<scoped_refptr<net::X509Certificate> > certs; ParseCertificateChain(signature_info.certificate_chain(0), &certs); - ASSERT_EQ(2, certs.size()); + ASSERT_EQ(2u, certs.size()); EXPECT_EQ("Joe's-Software-Emporium", certs[0]->subject().common_name); EXPECT_EQ("Root Agency", certs[1]->subject().common_name); @@ -73,7 +73,7 @@ TEST_F(BinaryFeatureExtractorWinTest, TrustedBinary) { ASSERT_EQ(1, signature_info.certificate_chain_size()); std::vector<scoped_refptr<net::X509Certificate> > certs; ParseCertificateChain(signature_info.certificate_chain(0), &certs); - ASSERT_EQ(3, certs.size()); + ASSERT_EQ(3u, certs.size()); EXPECT_EQ("Google Inc", certs[0]->subject().common_name); EXPECT_EQ("VeriSign Class 3 Code Signing 2009-2 CA", @@ -160,7 +160,7 @@ TEST_F(BinaryFeatureExtractorWinTest, ExtractImageFeaturesWithDebugData) { EXPECT_FALSE(pe_headers.has_optional_headers64()); EXPECT_NE(0, pe_headers.section_header_size()); EXPECT_TRUE(pe_headers.has_export_section_data()); - EXPECT_EQ(1U, pe_headers.debug_data_size()); + EXPECT_EQ(1, pe_headers.debug_data_size()); } TEST_F(BinaryFeatureExtractorWinTest, ExtractImageFeaturesWithoutExports) { @@ -179,7 +179,7 @@ TEST_F(BinaryFeatureExtractorWinTest, ExtractImageFeaturesWithoutExports) { EXPECT_FALSE(pe_headers.has_optional_headers64()); EXPECT_NE(0, pe_headers.section_header_size()); EXPECT_FALSE(pe_headers.has_export_section_data()); - EXPECT_EQ(1U, pe_headers.debug_data_size()); + EXPECT_EQ(1, pe_headers.debug_data_size()); } TEST_F(BinaryFeatureExtractorWinTest, ExtractImageFeaturesUntrustedSigned) { diff --git a/chrome/installer/gcapi/gcapi_reactivation_test.cc b/chrome/installer/gcapi/gcapi_reactivation_test.cc index 76069f7..34a1105 100644 --- a/chrome/installer/gcapi/gcapi_reactivation_test.cc +++ b/chrome/installer/gcapi/gcapi_reactivation_test.cc @@ -107,7 +107,7 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) { EXPECT_FALSE(CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_NOTINSTALLED, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_NOTINSTALLED), error); // Now pretend to be installed. CanOfferReactivation should pass. EXPECT_TRUE(SetChromeInstallMarker(HKEY_CURRENT_USER)); @@ -122,7 +122,7 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) { EXPECT_FALSE(CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_NOTDORMANT, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_NOTDORMANT), error); // Now set a last_run value that exceeds the threshold. hkcu_last_run = Time::NowFromSystemTime() - @@ -137,7 +137,7 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) { EXPECT_FALSE(CanOfferReactivation(NULL, GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_INVALID_INPUT, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_INVALID_INPUT), error); // One more valid one EXPECT_TRUE(CanOfferReactivation(L"GAGA", @@ -150,7 +150,7 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) { EXPECT_FALSE(CanOfferReactivation(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); } TEST_F(GCAPIReactivationTest, Reactivation_Flow) { @@ -173,7 +173,7 @@ TEST_F(GCAPIReactivationTest, Reactivation_Flow) { EXPECT_FALSE(ReactivateChrome(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); // Should not be able to reactivate under other brands: EXPECT_FALSE(ReactivateChrome(L"MAMA", @@ -185,7 +185,7 @@ TEST_F(GCAPIReactivationTest, Reactivation_Flow) { EXPECT_FALSE(ReactivateChrome(L"PFFT", GCAPI_INVOKED_STANDARD_SHELL, &error)); - EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error); + EXPECT_EQ(static_cast<DWORD>(REACTIVATE_ERROR_ALREADY_REACTIVATED), error); EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); } diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index 867106e..1dd8433 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc @@ -111,7 +111,7 @@ TEST_F(DeleteAfterRebootHelperTest, TestStringListToMultiSZConversions) { { L"deletes", L"foo\0\0bar\0\0bizz\0\0", 16 * sizeof(wchar_t), 3 }, }; - for (int i = 0; i < arraysize(tests); i++) { + for (size_t i = 0; i < arraysize(tests); i++) { std::vector<PendingMove> string_list; EXPECT_TRUE(SUCCEEDED( MultiSZBytesToStringArray(reinterpret_cast<const char*>(tests[i].str), @@ -132,7 +132,7 @@ TEST_F(DeleteAfterRebootHelperTest, TestStringListToMultiSZConversions) { {L"malformed", reinterpret_cast<const wchar_t*>("oddnumb\0\0"), 9, 1}, }; - for (int i = 0; i < arraysize(failures); i++) { + for (size_t i = 0; i < arraysize(failures); i++) { std::vector<PendingMove> string_list; EXPECT_FALSE(SUCCEEDED(MultiSZBytesToStringArray( reinterpret_cast<const char*>(failures[i].str), @@ -171,7 +171,7 @@ TEST_F(DeleteAfterRebootHelperTest, TestFileDeleteScheduleAndUnschedule) { // Check that each of the deletes we expect are there in order. base::FilePath expected_paths[] = { temp_file_, temp_subdir_file_, temp_subdir_, temp_dir_ }; - for (int i = 0; i < arraysize(expected_paths); ++i) { + for (size_t i = 0; i < arraysize(expected_paths); ++i) { EXPECT_FALSE(iter == pending_moves.end()); if (iter != pending_moves.end()) { base::FilePath short_path_name(GetShortPathName(expected_paths[i])); @@ -225,7 +225,7 @@ TEST_F(DeleteAfterRebootHelperTest, TestFileDeleteSchedulingWithActualDeletes) { // Check that each of the deletes we expect are there in order. base::FilePath expected_paths[] = { temp_file_, temp_subdir_file_, temp_subdir_, temp_dir_ }; - for (int i = 0; i < arraysize(expected_paths); ++i) { + for (size_t i = 0; i < arraysize(expected_paths); ++i) { EXPECT_FALSE(iter == pending_moves.end()); if (iter != pending_moves.end()) { base::FilePath short_path_name(GetShortPathName(expected_paths[i])); diff --git a/chrome/installer/util/delete_reg_value_work_item_unittest.cc b/chrome/installer/util/delete_reg_value_work_item_unittest.cc index 9a508ae..0c1f11e 100644 --- a/chrome/installer/util/delete_reg_value_work_item_unittest.cc +++ b/chrome/installer/util/delete_reg_value_work_item_unittest.cc @@ -92,8 +92,8 @@ TEST_F(DeleteRegValueWorkItemTest, DeleteExistingValue) { DWORD type = 0; DWORD size = 0; EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(kNameEmpty, NULL, &size, &type)); - EXPECT_EQ(REG_SZ, type); - EXPECT_EQ(0, size); + EXPECT_EQ(static_cast<DWORD>(REG_SZ), type); + EXPECT_EQ(0u, size); } // Try deleting a value that doesn't exist. diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index aee3a75..765d15b 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -100,7 +100,7 @@ class GoogleUpdateSettingsTest : public testing::Test { // Note that ap= value has to match "^2.0-d.*" or ".*x64-dev.*" and "^1.1-.*" // or ".*x64-beta.*" for dev and beta channels respectively. void TestCurrentChromeChannelWithVariousApValues(SystemUserInstall install) { - static struct Expectations { + static struct Expectation { const wchar_t* ap_value; const wchar_t* channel; bool supports_prefixes; @@ -123,13 +123,13 @@ class GoogleUpdateSettingsTest : public testing::Test { L"suffix-with-dash", }; - for (size_t i = 0; i < arraysize(prefixes); ++i) { - for (size_t j = 0; j < arraysize(expectations); ++j) { - for (size_t k = 0; k < arraysize(suffixes); ++k) { - base::string16 ap = prefixes[i]; - ap += expectations[j].ap_value; - ap += suffixes[k]; - const wchar_t* channel = expectations[j].channel; + for (const wchar_t* prefix : prefixes) { + for (const Expectation& expectation : expectations) { + for (const wchar_t* suffix : suffixes) { + base::string16 ap = prefix; + ap += expectation.ap_value; + ap += suffix; + const wchar_t* channel = expectation.channel; SetApField(install, ap.c_str()); base::string16 ret_channel; @@ -139,7 +139,7 @@ class GoogleUpdateSettingsTest : public testing::Test { // If prefixes are not supported for a channel, we expect the channel // to be "unknown" if a non-empty prefix is present in ap_value. - if (!expectations[j].supports_prefixes && wcslen(prefixes[i]) > 0) { + if (!expectation.supports_prefixes && wcslen(prefix) > 0) { EXPECT_STREQ(installer::kChromeChannelUnknown, ret_channel.c_str()) << "Expecting channel \"" << installer::kChromeChannelUnknown << "\" for ap=\"" << ap << "\""; @@ -444,10 +444,8 @@ TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { multifail_full }; ChannelInfo v; - for (int type_idx = 0; type_idx < arraysize(archive_types); ++type_idx) { - const installer::ArchiveType archive_type = archive_types[type_idx]; - for (int result_idx = 0; result_idx < arraysize(results); ++result_idx) { - const int result = results[result_idx]; + for (const installer::ArchiveType archive_type : archive_types) { + for (const int result : results) { // The archive type will/must always be known on install success. if (archive_type == installer::UNKNOWN_ARCHIVE_TYPE && result == installer::FIRST_INSTALL_SUCCESS) { @@ -461,9 +459,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { outputs = full; } // else if (archive_type == UNKNOWN) see below - for (int inputs_idx = 0; inputs_idx < arraysize(input_arrays); - ++inputs_idx) { - const wchar_t* const* inputs = input_arrays[inputs_idx]; + for (const wchar_t* const* inputs : input_arrays) { if (archive_type == installer::UNKNOWN_ARCHIVE_TYPE) { // "-full" is untouched if the archive type is unknown. // "-multifail" is unconditionally removed. @@ -472,7 +468,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { else outputs = plain; } - for (int input_idx = 0; input_idx < arraysize(plain); ++input_idx) { + for (size_t input_idx = 0; input_idx < arraysize(plain); ++input_idx) { const wchar_t* input = inputs[input_idx]; const wchar_t* output = outputs[input_idx]; @@ -720,8 +716,8 @@ TEST_F(GoogleUpdateSettingsTest, UpdateProfileCountsSystemInstall) { &aggregate)); // Verify the correct values were written. - EXPECT_EQ(3, num_profiles); - EXPECT_EQ(2, num_signed_in); + EXPECT_EQ(3u, num_profiles); + EXPECT_EQ(2u, num_signed_in); EXPECT_EQ(L"sum()", aggregate); } diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc index 8d0dcc7..40467f5 100644 --- a/chrome/installer/util/install_util_unittest.cc +++ b/chrome/installer/util/install_util_unittest.cc @@ -64,8 +64,7 @@ TEST_F(InstallUtilTest, ComposeCommandLine) { std::make_pair(std::wstring(L"spam.exe"), std::wstring(L"--do-something --silly")), }; - for (int i = 0; i < arraysize(params); ++i) { - std::pair<std::wstring, std::wstring>& param = params[i]; + for (std::pair<std::wstring, std::wstring>& param : params) { InstallUtil::ComposeCommandLine(param.first, param.second, &command_line); EXPECT_EQ(param.first, command_line.GetProgram().value()); if (param.second.empty()) { @@ -80,7 +79,7 @@ TEST_F(InstallUtilTest, ComposeCommandLine) { TEST_F(InstallUtilTest, GetCurrentDate) { std::wstring date(InstallUtil::GetCurrentDate()); - EXPECT_EQ(8, date.length()); + EXPECT_EQ(8u, date.length()); if (date.length() == 8) { // For an invalid date value, SystemTimeToFileTime will fail. // We use this to validate that we have a correct date string. diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index b408170..ac3ea11 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -543,7 +543,7 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { }; // Create the version directories. - for (int i = 0; i < arraysize(version_dirs); i++) { + for (size_t i = 0; i < arraysize(version_dirs); i++) { base::CreateDirectory(version_dirs[i]); EXPECT_TRUE(base::PathExists(version_dirs[i])); } @@ -564,7 +564,7 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { { installer_state.target_path().Append(installer::kChromeNewExe), new_chrome_exe_version }, }; - for (int i = 0; i < arraysize(targets); ++i) { + for (size_t i = 0; i < arraysize(targets); ++i) { ASSERT_TRUE(upgrade_test::GenerateSpecificPEFileVersion( exe_path, targets[i].target_file, targets[i].target_version)); } diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 06b959a..bbe085d 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc @@ -19,7 +19,7 @@ TEST(LoggingInstallerTest, TestTruncate) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file = temp_dir.path().Append(L"temp"); - EXPECT_EQ(test_data.size(), + EXPECT_EQ(static_cast<int>(test_data.size()), base::WriteFile(temp_file, &test_data[0], static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); @@ -45,7 +45,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file = temp_dir.path().Append(L"temp"); - EXPECT_EQ(test_data.size(), + EXPECT_EQ(static_cast<int>(test_data.size()), base::WriteFile(temp_file, &test_data[0], static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); @@ -68,7 +68,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file = temp_dir.path().Append(L"temp"); - EXPECT_EQ(test_data.size(), + EXPECT_EQ(static_cast<int>(test_data.size()), base::WriteFile(temp_file, &test_data[0], static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); @@ -97,7 +97,7 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file = temp_dir.path().Append(L"temp"); - EXPECT_EQ(test_data.size(), + EXPECT_EQ(static_cast<int>(test_data.size()), base::WriteFile(temp_file, &test_data[0], static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc index 05a8cb1..5f00a36 100644 --- a/chrome/installer/util/lzma_util_unittest.cc +++ b/chrome/installer/util/lzma_util_unittest.cc @@ -35,21 +35,25 @@ class LzmaUtilTest : public testing::Test { TEST_F(LzmaUtilTest, OpenArchiveTest) { base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); LzmaUtil lzma_util; - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); // We allow opening another archive (which will automatically close the first // archive). archive = data_dir_.AppendASCII("archive2.7z"); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); // Explicitly close and open the first archive again. lzma_util.CloseArchive(); archive = data_dir_.AppendASCII("archive1.7z"); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); // Make sure non-existent archive returns error. archive = data_dir_.AppendASCII("archive.non_existent.7z"); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), ERROR_FILE_NOT_FOUND); + EXPECT_EQ(static_cast<DWORD>(ERROR_FILE_NOT_FOUND), + lzma_util.OpenArchive(archive.value())); } // Test that we can extract archives successfully. @@ -62,32 +66,36 @@ TEST_F(LzmaUtilTest, UnPackTest) { base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); LzmaUtil lzma_util; - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); std::wstring unpacked_file; - EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), - NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.UnPack(extract_dir.value(), &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); - EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), - NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.UnPack(extract_dir.value(), &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); lzma_util.CloseArchive(); archive = data_dir_.AppendASCII("invalid_archive.7z"); - EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), - ERROR_INVALID_HANDLE); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); - EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), - ERROR_INVALID_HANDLE); + EXPECT_EQ(static_cast<DWORD>(ERROR_INVALID_HANDLE), + lzma_util.UnPack(extract_dir.value(), &unpacked_file)); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); + EXPECT_EQ(static_cast<DWORD>(ERROR_INVALID_HANDLE), + lzma_util.UnPack(extract_dir.value(), &unpacked_file)); archive = data_dir_.AppendASCII("archive3.7z"); - EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); - EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), - NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.OpenArchive(archive.value())); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + lzma_util.UnPack(extract_dir.value(), &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); EXPECT_TRUE(base::PathExists( extract_dir.AppendASCII("archive\\sub_dir\\text.txt"))); @@ -103,18 +111,21 @@ TEST_F(LzmaUtilTest, UnPackArchiveTest) { base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); std::wstring unpacked_file; - EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), - &unpacked_file), NO_ERROR); + EXPECT_EQ(NO_ERROR, + LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), + &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); - EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), - &unpacked_file), NO_ERROR); + EXPECT_EQ(NO_ERROR, + LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), + &unpacked_file)); EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); archive = data_dir_.AppendASCII("invalid_archive.7z"); - EXPECT_NE(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), - &unpacked_file), NO_ERROR); + EXPECT_NE(NO_ERROR, + LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), + &unpacked_file)); } diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index ebe28ff..99d9bda 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -99,7 +99,7 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) { installer::master_preferences::kRequireEula, }; - for (int i = 0; i < arraysize(expected_true); ++i) { + for (size_t i = 0; i < arraysize(expected_true); ++i) { bool value = false; EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); EXPECT_TRUE(value) << expected_true[i]; @@ -150,7 +150,7 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { }; bool value = false; - for (int i = 0; i < arraysize(expected_bool); ++i) { + for (size_t i = 0; i < arraysize(expected_bool); ++i) { EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; } @@ -163,7 +163,7 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { installer::master_preferences::kMakeChromeDefaultForUser, }; - for (int i = 0; i < arraysize(missing_bools); ++i) { + for (size_t i = 0; i < arraysize(missing_bools); ++i) { EXPECT_FALSE(prefs.GetBool(missing_bools[i], &value)) << missing_bools[i]; } @@ -202,7 +202,7 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) { installer::MasterPreferences prefs(prefs_file()); typedef std::vector<std::string> TabsVector; TabsVector tabs = prefs.GetFirstRunTabs(); - ASSERT_EQ(3, tabs.size()); + ASSERT_EQ(3u, tabs.size()); EXPECT_EQ("http://google.com/f1", tabs[0]); EXPECT_EQ("https://google.com/f2", tabs[1]); EXPECT_EQ("new_tab_page", tabs[2]); @@ -275,7 +275,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { // Now check that prefs got merged correctly. bool value = false; - for (int i = 0; i < arraysize(expected_bool); ++i) { + for (size_t i = 0; i < arraysize(expected_bool); ++i) { EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; } @@ -292,7 +292,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { { installer::master_preferences::kDoNotLaunchChrome, true }, }; - for (int i = 0; i < arraysize(expected_bool2); ++i) { + for (size_t i = 0; i < arraysize(expected_bool2); ++i) { EXPECT_TRUE(prefs2.GetBool(expected_bool2[i].name, &value)); EXPECT_EQ(value, expected_bool2[i].expected_value) << expected_bool2[i].name; diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index 64445e69..8f3df0e 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc @@ -28,7 +28,7 @@ std::string GetRandomFilename() { // Hexify the value. std::string result(base::HexEncode(&data[0], arraysize(data))); - EXPECT_EQ(8, result.size()); + EXPECT_EQ(8u, result.size()); // Replace the first digit with the letter 'R' (for "random", get it?). result[0] = 'R'; @@ -159,7 +159,7 @@ TEST_F(SelfCleaningTempDirTest, LeaveUsedOnDestroy) { EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); // Drop a file somewhere. - EXPECT_EQ(arraysize(kHiHon) - 1, + EXPECT_EQ(static_cast<int>(arraysize(kHiHon) - 1), base::WriteFile(parent_temp_dir.AppendASCII(GetRandomFilename()), kHiHon, arraysize(kHiHon) - 1)); } diff --git a/chrome/installer/util/set_reg_value_work_item_unittest.cc b/chrome/installer/util/set_reg_value_work_item_unittest.cc index 3916a34..c85346f 100644 --- a/chrome/installer/util/set_reg_value_work_item_unittest.cc +++ b/chrome/installer/util/set_reg_value_work_item_unittest.cc @@ -216,8 +216,8 @@ TEST_F(SetRegValueWorkItemTest, WriteExistingOverwrite) { DWORD type = 0; DWORD size = 0; EXPECT_EQ(ERROR_SUCCESS, test_key_.ReadValue(kNameEmpty, NULL, &size, &type)); - EXPECT_EQ(REG_SZ, type); - EXPECT_EQ(0, size); + EXPECT_EQ(static_cast<DWORD>(REG_SZ), type); + EXPECT_EQ(0u, size); // Now test REG_DWORD value. // Write data to the value we are going to set. diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index e581064..9b6308d 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -1023,7 +1023,7 @@ TEST(ShellUtilTest, GetUserSpecificRegistrySuffix) { base::string16 suffix; ASSERT_TRUE(ShellUtil::GetUserSpecificRegistrySuffix(&suffix)); ASSERT_TRUE(base::StartsWith(suffix, L".", base::CompareCase::SENSITIVE)); - ASSERT_EQ(27, suffix.length()); + ASSERT_EQ(27u, suffix.length()); ASSERT_TRUE(base::ContainsOnlyChars(suffix.substr(1), L"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")); } @@ -1048,7 +1048,7 @@ TEST(ShellUtilTest, ByteArrayToBase32) { L"MZXW6YTB", L"MZXW6YTBOI"}; // Run the tests, with one more letter in the input every pass. - for (int i = 0; i < arraysize(expected); ++i) { + for (size_t i = 0; i < arraysize(expected); ++i) { ASSERT_EQ(expected[i], ShellUtil::ByteArrayToBase32(test_array, i)); } diff --git a/chrome/installer/util/wmi_unittest.cc b/chrome/installer/util/wmi_unittest.cc index 163c041..798c534 100644 --- a/chrome/installer/util/wmi_unittest.cc +++ b/chrome/installer/util/wmi_unittest.cc @@ -14,7 +14,7 @@ TEST(WMITest, TestLocalConnectionSecurityBlanket) { EXPECT_TRUE(WMI::CreateLocalConnection(true, &services)); ASSERT_TRUE(NULL != services); ULONG refs = services->Release(); - EXPECT_EQ(refs, 0); + EXPECT_EQ(0u, refs); } TEST(WMITest, TestLocalConnectionNoSecurityBlanket) { @@ -22,7 +22,7 @@ TEST(WMITest, TestLocalConnectionNoSecurityBlanket) { EXPECT_TRUE(WMI::CreateLocalConnection(false, &services)); ASSERT_TRUE(NULL != services); ULONG refs = services->Release(); - EXPECT_EQ(refs, 0); + EXPECT_EQ(0u, refs); } TEST(WMITest, TestCreateClassMethod) { @@ -35,9 +35,9 @@ TEST(WMITest, TestCreateClassMethod) { L"Rename", &class_method)); ASSERT_TRUE(NULL != class_method); ULONG refs = class_method->Release(); - EXPECT_EQ(refs, 0); + EXPECT_EQ(0u, refs); refs = wmi_services->Release(); - EXPECT_EQ(refs, 0); + EXPECT_EQ(0u, refs); } // Creates an instance of cmd which executes 'echo' and exits immediately. diff --git a/chrome/utility/importer/edge_database_reader_unittest_win.cc b/chrome/utility/importer/edge_database_reader_unittest_win.cc index d0a0b77..c902bcb 100644 --- a/chrome/utility/importer/edge_database_reader_unittest_win.cc +++ b/chrome/utility/importer/edge_database_reader_unittest_win.cc @@ -194,7 +194,7 @@ TEST_F(EdgeDatabaseReaderTest, OpenTableAndReadDataDatabaseTest) { uint32_t uint_col_value = 0; EXPECT_TRUE(table_enum->RetrieveColumn(L"UIntCol", &uint_col_value)); - EXPECT_EQ(uint_col_value, row_count); + EXPECT_EQ(uint_col_value, static_cast<uint32_t>(row_count)); int64_t longlong_col_value = 0; EXPECT_TRUE( @@ -381,15 +381,15 @@ TEST_F(EdgeDatabaseReaderTest, CheckNullColumnDatabaseTest) { // back. int32_t int_col_value = 1; EXPECT_TRUE(table_enum->RetrieveColumn(L"IntCol", &int_col_value)); - EXPECT_EQ(int_col_value, 0); + EXPECT_EQ(0, int_col_value); uint32_t uint_col_value = 1; EXPECT_TRUE(table_enum->RetrieveColumn(L"UIntCol", &uint_col_value)); - EXPECT_EQ(uint_col_value, 0); + EXPECT_EQ(0u, uint_col_value); int64_t longlong_col_value = 1; EXPECT_TRUE(table_enum->RetrieveColumn(L"LongLongCol", &longlong_col_value)); - EXPECT_EQ(longlong_col_value, 0); + EXPECT_EQ(0, longlong_col_value); GUID guid_col_value = {}; GUID expected_guid_col_value = {}; diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc index 09d6a73..44f7aaf 100644 --- a/chrome_elf/blacklist/test/blacklist_test.cc +++ b/chrome_elf/blacklist/test/blacklist_test.cc @@ -65,7 +65,7 @@ class BlacklistTest : public testing::Test { base::FilePath current_dir; ASSERT_TRUE(PathService::Get(base::DIR_EXE, ¤t_dir)); - for (int i = 0; i < arraysize(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { // Ensure that the dll has not been loaded both by inspecting the handle // returned by LoadLibrary and by looking for an environment variable that // is set when the DLL's entry point is called. @@ -233,7 +233,7 @@ TEST_F(BlacklistTest, LoadBlacklistedLibrary) { EXPECT_EQ(num_initially_blocked_, num_blocked_dlls); // Add all DLLs to the blacklist then check they are blocked. - for (int i = 0; i < arraysize(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { EXPECT_TRUE(TestDll_AddDllToBlacklist(test_data[i].dll_name)); } CheckBlacklistedDllsNotLoaded(); @@ -254,7 +254,7 @@ TEST_F(BlacklistTest, AddDllsFromRegistryToBlacklist) { HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_QUERY_VALUE | KEY_SET_VALUE); - for (int i = 0; i < arraysize(test_data); ++i) { + for (size_t i = 0; i < arraysize(test_data); ++i) { finch_blacklist_registry_key.WriteValue(test_data[i].dll_name, test_data[i].dll_name); } diff --git a/chrome_elf/elf_imports_unittest.cc b/chrome_elf/elf_imports_unittest.cc index 87a1f59..806ed79 100644 --- a/chrome_elf/elf_imports_unittest.cc +++ b/chrome_elf/elf_imports_unittest.cc @@ -91,8 +91,8 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) { // Make sure all of ELF's imports are in the valid imports list. for (const std::string& import : elf_imports) { bool match = false; - for (int i = 0; i < arraysize(kValidFilePatterns); ++i) { - if (base::MatchPattern(import, kValidFilePatterns[i])) { + for (const char* kValidFilePattern : kValidFilePatterns) { + if (base::MatchPattern(import, kValidFilePattern)) { match = true; break; } diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc index 84963c0..5df48a0 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc @@ -143,7 +143,7 @@ TEST_F(PortMonitorTest, EnumPortsTest) { 0, &needed_bytes, &returned)); - EXPECT_EQ(ERROR_INSUFFICIENT_BUFFER, GetLastError()); + EXPECT_EQ(static_cast<DWORD>(ERROR_INSUFFICIENT_BUFFER), GetLastError()); EXPECT_NE(0u, needed_bytes); EXPECT_EQ(0u, returned); @@ -171,7 +171,7 @@ TEST_F(PortMonitorTest, EnumPortsTest) { 0, &needed_bytes, &returned)); - EXPECT_EQ(ERROR_INSUFFICIENT_BUFFER, GetLastError()); + EXPECT_EQ(static_cast<DWORD>(ERROR_INSUFFICIENT_BUFFER), GetLastError()); EXPECT_NE(0u, needed_bytes); EXPECT_EQ(0u, returned); @@ -213,14 +213,9 @@ TEST_F(PortMonitorTest, FlowTest) { EXPECT_TRUE(monitor2->pfnXcvOpenPort(monitor_handle, NULL, 0, &xcv_handle)); EXPECT_TRUE(xcv_handle != NULL); EXPECT_TRUE(monitor2->pfnXcvDataPort != NULL); - EXPECT_EQ(ERROR_ACCESS_DENIED, - monitor2->pfnXcvDataPort(xcv_handle, - kXcvDataItem, - NULL, - 0, - buffer, - kBufferSize, - &bytes_needed)); + EXPECT_EQ(static_cast<DWORD>(ERROR_ACCESS_DENIED), + monitor2->pfnXcvDataPort(xcv_handle, kXcvDataItem, NULL, 0, buffer, + kBufferSize, &bytes_needed)); EXPECT_TRUE(monitor2->pfnXcvClosePort != NULL); EXPECT_TRUE(monitor2->pfnXcvClosePort(xcv_handle)); EXPECT_TRUE(monitor2->pfnXcvOpenPort(monitor_handle, @@ -229,14 +224,9 @@ TEST_F(PortMonitorTest, FlowTest) { &xcv_handle)); EXPECT_TRUE(xcv_handle != NULL); EXPECT_TRUE(monitor2->pfnXcvDataPort != NULL); - EXPECT_EQ(ERROR_SUCCESS, - monitor2->pfnXcvDataPort(xcv_handle, - kXcvDataItem, - NULL, - 0, - buffer, - kBufferSize, - &bytes_needed)); + EXPECT_EQ(static_cast<DWORD>(ERROR_SUCCESS), + monitor2->pfnXcvDataPort(xcv_handle, kXcvDataItem, NULL, 0, buffer, + kBufferSize, &bytes_needed)); EXPECT_TRUE(monitor2->pfnXcvClosePort != NULL); EXPECT_TRUE(monitor2->pfnXcvClosePort(xcv_handle)); @@ -256,7 +246,7 @@ TEST_F(PortMonitorTest, FlowTest) { buffer, kBufferSize, &bytes_processed)); - EXPECT_EQ(0, bytes_processed); + EXPECT_EQ(0u, bytes_processed); EXPECT_FALSE(monitor2->pfnReadPort(port_handle, buffer, sizeof(buffer), diff --git a/components/browser_watcher/endsession_watcher_window_win_unittest.cc b/components/browser_watcher/endsession_watcher_window_win_unittest.cc index e499b4b..bc019eb 100644 --- a/components/browser_watcher/endsession_watcher_window_win_unittest.cc +++ b/components/browser_watcher/endsession_watcher_window_win_unittest.cc @@ -28,7 +28,7 @@ class EndSessionWatcherWindowTest : public testing::Test { size_t num_callbacks_; UINT last_message_; - UINT last_lparam_; + LPARAM last_lparam_; }; } // namespace browser_watcher @@ -40,8 +40,8 @@ TEST_F(EndSessionWatcherWindowTest, NoCallbackOnDestruction) { base::Unretained(this))); } - EXPECT_EQ(num_callbacks_, 0); - EXPECT_EQ(last_lparam_, 0); + EXPECT_EQ(0u, num_callbacks_); + EXPECT_EQ(0, last_lparam_); } TEST_F(EndSessionWatcherWindowTest, IssuesCallbackOnMessage) { @@ -49,19 +49,19 @@ TEST_F(EndSessionWatcherWindowTest, IssuesCallbackOnMessage) { base::Bind(&EndSessionWatcherWindowTest::OnEndSessionMessage, base::Unretained(this))); - ::SendMessage(watcher_window.window(), WM_QUERYENDSESSION, TRUE, 0xCAFEBABE); - EXPECT_EQ(num_callbacks_, 1); - EXPECT_EQ(last_message_, WM_QUERYENDSESSION); - EXPECT_EQ(last_lparam_, 0xCAFEBABE); + ::SendMessage(watcher_window.window(), WM_QUERYENDSESSION, TRUE, 0xBEEF); + EXPECT_EQ(1u, num_callbacks_); + EXPECT_EQ(static_cast<DWORD>(WM_QUERYENDSESSION), last_message_); + EXPECT_EQ(0xBEEF, last_lparam_); ::SendMessage(watcher_window.window(), WM_ENDSESSION, TRUE, 0xCAFE); - EXPECT_EQ(num_callbacks_, 2); - EXPECT_EQ(last_message_, WM_ENDSESSION); - EXPECT_EQ(last_lparam_, 0xCAFE); + EXPECT_EQ(2u, num_callbacks_); + EXPECT_EQ(static_cast<UINT>(WM_ENDSESSION), last_message_); + EXPECT_EQ(0xCAFE, last_lparam_); // Verify that other messages don't pass through. ::SendMessage(watcher_window.window(), WM_CLOSE, TRUE, 0xCAFE); - EXPECT_EQ(num_callbacks_, 2); + EXPECT_EQ(2u, num_callbacks_); } } // namespace browser_watcher diff --git a/components/browser_watcher/exit_code_watcher_win_unittest.cc b/components/browser_watcher/exit_code_watcher_win_unittest.cc index 118cf77..df7de86 100644 --- a/components/browser_watcher/exit_code_watcher_win_unittest.cc +++ b/components/browser_watcher/exit_code_watcher_win_unittest.cc @@ -92,7 +92,7 @@ class ExitCodeWatcherTest : public testing::Test { base::win::RegistryValueIterator it( HKEY_CURRENT_USER, kRegistryPath); - ASSERT_EQ(1, it.ValueCount()); + ASSERT_EQ(1u, it.ValueCount()); base::win::RegKey key(HKEY_CURRENT_USER, kRegistryPath, KEY_QUERY_VALUE); @@ -104,7 +104,7 @@ class ExitCodeWatcherTest : public testing::Test { base::CompareCase::SENSITIVE)); DWORD value = 0; ASSERT_EQ(ERROR_SUCCESS, key.ReadValueDW(it.Name(), &value)); - ASSERT_EQ(exit_code, value); + ASSERT_EQ(exit_code, static_cast<int>(value)); } protected: diff --git a/components/browser_watcher/exit_funnel_win_unittest.cc b/components/browser_watcher/exit_funnel_win_unittest.cc index b43b273..d45a291 100644 --- a/components/browser_watcher/exit_funnel_win_unittest.cc +++ b/components/browser_watcher/exit_funnel_win_unittest.cc @@ -37,7 +37,7 @@ class ExitFunnelWinTest : public testing::Test { base::string16 GetEventSubkey() { // There should be a single subkey named after this process' pid. base::win::RegistryKeyIterator it(HKEY_CURRENT_USER, kRegistryPath); - EXPECT_EQ(1, it.SubkeyCount()); + EXPECT_EQ(1u, it.SubkeyCount()); unsigned pid = 0; base::StringToUint(it.Name(), &pid); @@ -53,7 +53,7 @@ class ExitFunnelWinTest : public testing::Test { base::win::RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ); EXPECT_TRUE(key.Valid()); - EXPECT_EQ(2, key.GetValueCount()); + EXPECT_EQ(2u, key.GetValueCount()); EventMap events; for (size_t i = 0; i < key.GetValueCount(); ++i) { @@ -86,7 +86,7 @@ TEST_F(ExitFunnelWinTest, RecordSingleEvent) { EventMap events = ReadEvents(); - ASSERT_EQ(events.size(), 2); + ASSERT_EQ(2u, events.size()); ASSERT_TRUE(events.find(L"One") != events.end()); ASSERT_TRUE(events.find(L"Two") != events.end()); } @@ -103,7 +103,7 @@ TEST_F(ExitFunnelWinTest, RecordsEventTimes) { ASSERT_TRUE(funnel.RecordEvent(L"Two")); EventMap events = ReadEvents(); - ASSERT_EQ(events.size(), 2); + ASSERT_EQ(2u, events.size()); base::TimeDelta one = base::TimeDelta::FromInternalValue(events[L"One"]); base::TimeDelta two = base::TimeDelta::FromInternalValue(events[L"Two"]); diff --git a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc index f77f54f..7573b30 100644 --- a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc +++ b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc @@ -50,7 +50,7 @@ class WatcherMetricsProviderWinTest : public testing::Test { base::string16 key_name(base::StringPrintf(L"%d-%d", pid, rand())); // Write the exit code to registry. - ULONG result = key.WriteValue(key_name.c_str(), exit_code); + LONG result = key.WriteValue(key_name.c_str(), exit_code); ASSERT_EQ(result, ERROR_SUCCESS); } @@ -95,7 +95,7 @@ TEST_F(WatcherMetricsProviderWinTest, RecordsStabilityHistogram) { WatcherMetricsProviderWin::kBrowserExitCodeHistogramName, 12); // Verify that the reported values are gone. - EXPECT_EQ(ExitCodeRegistryPathValueCount(), 0); + EXPECT_EQ(0u, ExitCodeRegistryPathValueCount()); } TEST_F(WatcherMetricsProviderWinTest, DoesNotReportOwnProcessId) { @@ -113,7 +113,7 @@ TEST_F(WatcherMetricsProviderWinTest, DoesNotReportOwnProcessId) { WatcherMetricsProviderWin::kBrowserExitCodeHistogramName, 0, 11); // Verify that the reported values are gone. - EXPECT_EQ(ExitCodeRegistryPathValueCount(), 1); + EXPECT_EQ(1u, ExitCodeRegistryPathValueCount()); } TEST_F(WatcherMetricsProviderWinTest, DeletesRecordedExitFunnelEvents) { @@ -124,7 +124,7 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesRecordedExitFunnelEvents) { AddExitFunnelEvent(102, L"Three", 990 * 1000); base::win::RegistryKeyIterator it(HKEY_CURRENT_USER, kRegistryPath); - EXPECT_EQ(it.SubkeyCount(), 3); + EXPECT_EQ(3u, it.SubkeyCount()); WatcherMetricsProviderWin provider(kRegistryPath, test_task_runner_.get()); @@ -138,7 +138,7 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesRecordedExitFunnelEvents) { histogram_tester_.GetAllSamples("Stability.ExitFunnel.Three").empty()); // Make sure the subkeys are deleted on reporting. - ASSERT_EQ(it.SubkeyCount(), 0); + ASSERT_EQ(0u, it.SubkeyCount()); } TEST_F(WatcherMetricsProviderWinTest, DeletesExitcodeKeyWhenNotReporting) { @@ -187,7 +187,7 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesOnly100FunnelsAtATime) { } base::win::RegistryKeyIterator it(HKEY_CURRENT_USER, kRegistryPath); - EXPECT_EQ(it.SubkeyCount(), 200); + EXPECT_EQ(200u, it.SubkeyCount()); { // Make like the user is opted out of reporting. @@ -198,7 +198,7 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesOnly100FunnelsAtATime) { } // We expect only 100 of the funnels have been scrubbed. - EXPECT_EQ(it.SubkeyCount(), 100); + EXPECT_EQ(100u, it.SubkeyCount()); } } // namespace browser_watcher diff --git a/components/crash/content/app/crash_keys_win_unittest.cc b/components/crash/content/app/crash_keys_win_unittest.cc index f1a645e..197066f 100644 --- a/components/crash/content/app/crash_keys_win_unittest.cc +++ b/components/crash/content/app/crash_keys_win_unittest.cc @@ -129,15 +129,15 @@ TEST_F(CrashKeysWinTest, OfficialLikeKeys) { // We expect 7 fixed keys and a "freeboard" of 256 keys for dynamic entries. EXPECT_EQ(256U + 7U, info->count); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"ver", L"1.2.3.4")); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"prod", L"SomeProdName")); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"plat", L"Win32")); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"ptype", L"made_up_type")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"ver", L"1.2.3.4")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"prod", L"SomeProdName")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"plat", L"Win32")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"ptype", L"made_up_type")); std::wstring pid_str(base::StringPrintf(L"%d", ::GetCurrentProcessId())); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"pid", pid_str.c_str())); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"channel", L"-devm")); - EXPECT_EQ(1, CountKeyValueOccurences(info, L"profile-type", L"temporary")); - EXPECT_EQ(256, CountKeyValueOccurences(info, L"unspecified-crash-key", L"")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"pid", pid_str.c_str())); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"channel", L"-devm")); + EXPECT_EQ(1u, CountKeyValueOccurences(info, L"profile-type", L"temporary")); + EXPECT_EQ(256u, CountKeyValueOccurences(info, L"unspecified-crash-key", L"")); } } // namespace breakpad diff --git a/components/policy/core/common/registry_dict_win_unittest.cc b/components/policy/core/common/registry_dict_win_unittest.cc index 4db7ead..f5a393a 100644 --- a/components/policy/core/common/registry_dict_win_unittest.cc +++ b/components/policy/core/common/registry_dict_win_unittest.cc @@ -20,17 +20,17 @@ TEST(RegistryDictTest, SetAndGetValue) { base::StringValue string_value("fortytwo"); test_dict.SetValue("one", scoped_ptr<base::Value>(int_value.DeepCopy())); - EXPECT_EQ(1, test_dict.values().size()); + EXPECT_EQ(1u, test_dict.values().size()); EXPECT_TRUE(base::Value::Equals(&int_value, test_dict.GetValue("one"))); EXPECT_FALSE(test_dict.GetValue("two")); test_dict.SetValue("two", scoped_ptr<base::Value>(string_value.DeepCopy())); - EXPECT_EQ(2, test_dict.values().size()); + EXPECT_EQ(2u, test_dict.values().size()); EXPECT_TRUE(base::Value::Equals(&int_value, test_dict.GetValue("one"))); EXPECT_TRUE(base::Value::Equals(&string_value, test_dict.GetValue("two"))); scoped_ptr<base::Value> one(test_dict.RemoveValue("one")); - EXPECT_EQ(1, test_dict.values().size()); + EXPECT_EQ(1u, test_dict.values().size()); EXPECT_TRUE(base::Value::Equals(&int_value, one.get())); EXPECT_FALSE(test_dict.GetValue("one")); EXPECT_TRUE(base::Value::Equals(&string_value, test_dict.GetValue("two"))); @@ -48,7 +48,7 @@ TEST(RegistryDictTest, CaseInsensitiveButPreservingValueNames) { base::StringValue string_value("fortytwo"); test_dict.SetValue("One", scoped_ptr<base::Value>(int_value.DeepCopy())); - EXPECT_EQ(1, test_dict.values().size()); + EXPECT_EQ(1u, test_dict.values().size()); EXPECT_TRUE(base::Value::Equals(&int_value, test_dict.GetValue("oNe"))); RegistryDict::ValueMap::const_iterator entry = test_dict.values().begin(); @@ -56,7 +56,7 @@ TEST(RegistryDictTest, CaseInsensitiveButPreservingValueNames) { EXPECT_EQ("One", entry->first); test_dict.SetValue("ONE", scoped_ptr<base::Value>(string_value.DeepCopy())); - EXPECT_EQ(1, test_dict.values().size()); + EXPECT_EQ(1u, test_dict.values().size()); EXPECT_TRUE(base::Value::Equals(&string_value, test_dict.GetValue("one"))); scoped_ptr<base::Value> removed_value(test_dict.RemoveValue("onE")); @@ -73,7 +73,7 @@ TEST(RegistryDictTest, SetAndGetKeys) { scoped_ptr<RegistryDict> subdict(new RegistryDict()); subdict->SetValue("one", scoped_ptr<base::Value>(int_value.DeepCopy())); test_dict.SetKey("two", subdict.Pass()); - EXPECT_EQ(1, test_dict.keys().size()); + EXPECT_EQ(1u, test_dict.keys().size()); RegistryDict* actual_subdict = test_dict.GetKey("two"); ASSERT_TRUE(actual_subdict); EXPECT_TRUE(base::Value::Equals(&int_value, actual_subdict->GetValue("one"))); @@ -81,7 +81,7 @@ TEST(RegistryDictTest, SetAndGetKeys) { subdict.reset(new RegistryDict()); subdict->SetValue("three", scoped_ptr<base::Value>(string_value.DeepCopy())); test_dict.SetKey("four", subdict.Pass()); - EXPECT_EQ(2, test_dict.keys().size()); + EXPECT_EQ(2u, test_dict.keys().size()); actual_subdict = test_dict.GetKey("two"); ASSERT_TRUE(actual_subdict); EXPECT_TRUE(base::Value::Equals(&int_value, actual_subdict->GetValue("one"))); @@ -102,7 +102,7 @@ TEST(RegistryDictTest, CaseInsensitiveButPreservingKeyNames) { base::FundamentalValue int_value(42); test_dict.SetKey("One", make_scoped_ptr(new RegistryDict()).Pass()); - EXPECT_EQ(1, test_dict.keys().size()); + EXPECT_EQ(1u, test_dict.keys().size()); RegistryDict* actual_subdict = test_dict.GetKey("One"); ASSERT_TRUE(actual_subdict); EXPECT_TRUE(actual_subdict->values().empty()); @@ -114,7 +114,7 @@ TEST(RegistryDictTest, CaseInsensitiveButPreservingKeyNames) { scoped_ptr<RegistryDict> subdict(new RegistryDict()); subdict->SetValue("two", scoped_ptr<base::Value>(int_value.DeepCopy())); test_dict.SetKey("ONE", subdict.Pass()); - EXPECT_EQ(1, test_dict.keys().size()); + EXPECT_EQ(1u, test_dict.keys().size()); actual_subdict = test_dict.GetKey("One"); ASSERT_TRUE(actual_subdict); EXPECT_TRUE(base::Value::Equals(&int_value, diff --git a/components/storage_monitor/storage_monitor_win_unittest.cc b/components/storage_monitor/storage_monitor_win_unittest.cc index 84eb51e..f146cfc 100644 --- a/components/storage_monitor/storage_monitor_win_unittest.cc +++ b/components/storage_monitor/storage_monitor_win_unittest.cc @@ -295,7 +295,7 @@ TEST_F(StorageMonitorWinTest, DevicesAttached) { TEST_F(StorageMonitorWinTest, PathMountDevices) { PreAttachDevices(); - int init_storages = monitor_->GetAllAvailableStorages().size(); + size_t init_storages = monitor_->GetAllAvailableStorages().size(); volume_mount_watcher_->AddDeviceForTesting( base::FilePath(FILE_PATH_LITERAL("F:\\mount1")), @@ -475,7 +475,7 @@ TEST_F(StorageMonitorWinTest, DeviceInfoForPath) { EXPECT_EQ(info.device_id(), device_info.device_id()); EXPECT_EQ(info.GetDisplayName(false), device_info.GetDisplayName(false)); EXPECT_EQ(info.location(), device_info.location()); - EXPECT_EQ(1000000, info.total_size_in_bytes()); + EXPECT_EQ(1000000u, info.total_size_in_bytes()); // A fixed device. base::FilePath fixed_device(L"N:\\"); diff --git a/device/bluetooth/bluetooth_adapter_win_unittest.cc b/device/bluetooth/bluetooth_adapter_win_unittest.cc index 2e2c7ae..edead70 100644 --- a/device/bluetooth/bluetooth_adapter_win_unittest.cc +++ b/device/bluetooth/bluetooth_adapter_win_unittest.cc @@ -169,7 +169,7 @@ TEST_F(BluetoothAdapterWinTest, SingleStartDiscovery) { base::Unretained(this)), DiscoverySessionErrorCallback()); EXPECT_TRUE(ui_task_runner_->GetPendingTasks().empty()); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); EXPECT_FALSE(adapter_->IsDiscovering()); EXPECT_EQ(0, num_start_discovery_callbacks_); adapter_win_->DiscoveryStarted(true); @@ -201,7 +201,7 @@ TEST_F(BluetoothAdapterWinTest, MultipleStartDiscoveries) { &BluetoothAdapterWinTest::IncrementNumStartDiscoveryCallbacks, base::Unretained(this)), DiscoverySessionErrorCallback()); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); } EXPECT_TRUE(ui_task_runner_->GetPendingTasks().empty()); EXPECT_FALSE(adapter_->IsDiscovering()); @@ -317,7 +317,7 @@ TEST_F(BluetoothAdapterWinTest, MultipleStopDiscoveries) { base::Bind(&BluetoothAdapterWinTest::IncrementNumStopDiscoveryCallbacks, base::Unretained(this)), DiscoverySessionErrorCallback()); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); EXPECT_TRUE(adapter_->IsDiscovering()); adapter_win_->DiscoveryStopped(); ui_task_runner_->RunPendingTasks(); @@ -348,7 +348,7 @@ TEST_F(BluetoothAdapterWinTest, base::Bind(&BluetoothAdapterWinTest::IncrementNumStopDiscoveryCallbacks, base::Unretained(this)), DiscoverySessionErrorCallback()); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); } TEST_F(BluetoothAdapterWinTest, @@ -371,7 +371,7 @@ TEST_F(BluetoothAdapterWinTest, StartDiscoveryBeforeDiscoveryStopped) { CallAddDiscoverySession(base::Closure(), DiscoverySessionErrorCallback()); bluetooth_task_runner_->ClearPendingTasks(); adapter_win_->DiscoveryStopped(); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); } TEST_F(BluetoothAdapterWinTest, StopDiscoveryWithoutStartDiscovery) { @@ -388,7 +388,7 @@ TEST_F(BluetoothAdapterWinTest, StopDiscoveryBeforeDiscoveryStarted) { CallRemoveDiscoverySession(base::Closure(), DiscoverySessionErrorCallback()); bluetooth_task_runner_->ClearPendingTasks(); adapter_win_->DiscoveryStarted(true); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); } TEST_F(BluetoothAdapterWinTest, StartAndStopBeforeDiscoveryStarted) { diff --git a/device/bluetooth/bluetooth_device_win_unittest.cc b/device/bluetooth/bluetooth_device_win_unittest.cc index c9d48a3..0fb9d32 100644 --- a/device/bluetooth/bluetooth_device_win_unittest.cc +++ b/device/bluetooth/bluetooth_device_win_unittest.cc @@ -86,12 +86,12 @@ class BluetoothDeviceWinTest : public testing::Test { TEST_F(BluetoothDeviceWinTest, GetUUIDs) { BluetoothDevice::UUIDList uuids = device_->GetUUIDs(); - EXPECT_EQ(2, uuids.size()); + EXPECT_EQ(2u, uuids.size()); EXPECT_EQ(kTestAudioSdpUuid, uuids[0]); EXPECT_EQ(kTestVideoSdpUuid, uuids[1]); uuids = empty_device_->GetUUIDs(); - EXPECT_EQ(0, uuids.size()); + EXPECT_EQ(0u, uuids.size()); } TEST_F(BluetoothDeviceWinTest, IsEqual) { diff --git a/device/bluetooth/bluetooth_service_record_win_unittest.cc b/device/bluetooth/bluetooth_service_record_win_unittest.cc index 274028e..116f740 100644 --- a/device/bluetooth/bluetooth_service_record_win_unittest.cc +++ b/device/bluetooth/bluetooth_service_record_win_unittest.cc @@ -60,7 +60,7 @@ TEST_F(BluetoothServiceRecordWinTest, BthAddr) { ConvertSdpBytes(kTestRfcommSdpBytes, &sdp_bytes_array); BluetoothServiceRecordWin service_record( "01:02:03:0A:10:A0", "Sdp", sdp_bytes_array, BluetoothUUID()); - EXPECT_EQ(1108152553632, service_record.device_bth_addr()); + EXPECT_EQ(1108152553632ull, service_record.device_bth_addr()); } } // namespace device diff --git a/device/bluetooth/bluetooth_task_manager_win_unittest.cc b/device/bluetooth/bluetooth_task_manager_win_unittest.cc index 0a82c7d..5e0f3ad 100644 --- a/device/bluetooth/bluetooth_task_manager_win_unittest.cc +++ b/device/bluetooth/bluetooth_task_manager_win_unittest.cc @@ -80,12 +80,12 @@ class BluetoothTaskManagerWinTest : public testing::Test { }; TEST_F(BluetoothTaskManagerWinTest, StartPolling) { - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); } TEST_F(BluetoothTaskManagerWinTest, PollAdapterIfBluetoothStackIsAvailable) { bluetooth_task_runner_->RunPendingTasks(); - int num_expected_pending_tasks = has_bluetooth_stack_ ? 1 : 0; + size_t num_expected_pending_tasks = has_bluetooth_stack_ ? 1 : 0; EXPECT_EQ(num_expected_pending_tasks, bluetooth_task_runner_->GetPendingTasks().size()); } @@ -112,7 +112,7 @@ TEST_F(BluetoothTaskManagerWinTest, SetPowered) { base::Closure closure; task_manager_->PostSetPoweredBluetoothTask(true, closure, closure); - EXPECT_EQ(1, bluetooth_task_runner_->GetPendingTasks().size()); + EXPECT_EQ(1u, bluetooth_task_runner_->GetPendingTasks().size()); bluetooth_task_runner_->RunPendingTasks(); EXPECT_TRUE(ui_task_runner_->GetPendingTasks().size() >= 1); } diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc index 0af821c..72ddd4c 100644 --- a/device/hid/hid_service_win.cc +++ b/device/hid/hid_service_win.cc @@ -290,8 +290,7 @@ base::win::ScopedHandle HidServiceWin::OpenDevice( CreateFileA(device_path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)); - if (!file.IsValid() && - GetLastError() == base::File::FILE_ERROR_ACCESS_DENIED) { + if (!file.IsValid() && GetLastError() == ERROR_ACCESS_DENIED) { file.Set(CreateFileA(device_path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)); } diff --git a/media/audio/win/audio_low_latency_output_win_unittest.cc b/media/audio/win/audio_low_latency_output_win_unittest.cc index 4c39228..5c2d457 100644 --- a/media/audio/win/audio_low_latency_output_win_unittest.cc +++ b/media/audio/win/audio_low_latency_output_win_unittest.cc @@ -432,7 +432,7 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromStereoFile) { DVLOG(0) << "#file segments : " << kNumFileSegments; DVLOG(0) << ">> Listen to the stereo file while playing..."; - for (int i = 0; i < kNumFileSegments; i++) { + for (size_t i = 0; i < kNumFileSegments; i++) { // Each segment will start with a short (~20ms) block of zeros, hence // some short glitches might be heard in this test if kNumFileSegments // is larger than one. The exact length of the silence period depends on diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc index e1351e4d..0f850d3 100644 --- a/media/audio/win/core_audio_util_win_unittest.cc +++ b/media/audio/win/core_audio_util_win_unittest.cc @@ -73,7 +73,7 @@ TEST_F(CoreAudioUtilWinTest, CreateDefaultDevice) { // Create default devices for all flow/role combinations above. ScopedComPtr<IMMDevice> audio_device; - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { audio_device = CoreAudioUtil::CreateDefaultDevice(data[i].flow, data[i].role); EXPECT_TRUE(audio_device.get()); @@ -125,7 +125,7 @@ TEST_F(CoreAudioUtilWinTest, GetDefaultDeviceName) { // Get name and ID of default devices for all flow/role combinations above. ScopedComPtr<IMMDevice> audio_device; AudioDeviceName device_name; - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { audio_device = CoreAudioUtil::CreateDefaultDevice(data[i].flow, data[i].role); EXPECT_TRUE(SUCCEEDED( @@ -145,7 +145,7 @@ TEST_F(CoreAudioUtilWinTest, GetAudioControllerID) { // Enumerate all active input and output devices and fetch the ID of // the associated device. EDataFlow flows[] = { eRender , eCapture }; - for (int i = 0; i < arraysize(flows); ++i) { + for (size_t i = 0; i < arraysize(flows); ++i) { ScopedComPtr<IMMDeviceCollection> collection; ASSERT_TRUE(SUCCEEDED(enumerator->EnumAudioEndpoints(flows[i], DEVICE_STATE_ACTIVE, collection.Receive()))); @@ -205,7 +205,7 @@ TEST_F(CoreAudioUtilWinTest, CreateDefaultClient) { EDataFlow data[] = {eRender, eCapture}; - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IAudioClient> client; client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole); EXPECT_TRUE(client.get()); @@ -217,7 +217,7 @@ TEST_F(CoreAudioUtilWinTest, CreateClient) { EDataFlow data[] = {eRender, eCapture}; - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IMMDevice> device; ScopedComPtr<IAudioClient> client; device = CoreAudioUtil::CreateDefaultDevice(data[i], eConsole); @@ -282,7 +282,7 @@ TEST_F(CoreAudioUtilWinTest, GetDevicePeriod) { // Verify that the device periods are valid for the default render and // capture devices. - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IAudioClient> client; REFERENCE_TIME shared_time_period = 0; REFERENCE_TIME exclusive_time_period = 0; @@ -305,7 +305,7 @@ TEST_F(CoreAudioUtilWinTest, GetPreferredAudioParameters) { // Verify that the preferred audio parameters are OK for the default render // and capture devices. - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IAudioClient> client; AudioParameters params; client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole); @@ -386,7 +386,7 @@ TEST_F(CoreAudioUtilWinTest, CreateRenderAndCaptureClients) { WAVEFORMATPCMEX format; uint32 endpoint_buffer_size = 0; - for (int i = 0; i < arraysize(data); ++i) { + for (size_t i = 0; i < arraysize(data); ++i) { ScopedComPtr<IAudioClient> client; ScopedComPtr<IAudioRenderClient> render_client; ScopedComPtr<IAudioCaptureClient> capture_client; diff --git a/net/base/network_interfaces_unittest.cc b/net/base/network_interfaces_unittest.cc index 06ffb07..470295f 100644 --- a/net/base/network_interfaces_unittest.cc +++ b/net/base/network_interfaces_unittest.cc @@ -163,9 +163,10 @@ TEST(NetUtilTest, GetNetworkList) { if (interface_to_luid && luid_to_guid) { NET_LUID luid; - EXPECT_EQ(interface_to_luid(it->interface_index, &luid), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), + interface_to_luid(it->interface_index, &luid)); GUID guid; - EXPECT_EQ(luid_to_guid(&luid, &guid), NO_ERROR); + EXPECT_EQ(static_cast<DWORD>(NO_ERROR), luid_to_guid(&luid, &guid)); LPOLESTR name; StringFromCLSID(guid, &name); EXPECT_STREQ(base::UTF8ToWide(it->name).c_str(), name); diff --git a/net/http/http_auth_sspi_win_unittest.cc b/net/http/http_auth_sspi_win_unittest.cc index feebaf0..103d0c2 100644 --- a/net/http/http_auth_sspi_win_unittest.cc +++ b/net/http/http_auth_sspi_win_unittest.cc @@ -48,7 +48,7 @@ TEST(HttpAuthSSPITest, DetermineMaxTokenLength_Normal) { ULONG max_token_length = kMaxTokenLength; int rv = DetermineMaxTokenLength(&mock_library, L"NTLM", &max_token_length); EXPECT_EQ(OK, rv); - EXPECT_EQ(1337, max_token_length); + EXPECT_EQ(1337u, max_token_length); } TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) { @@ -60,7 +60,7 @@ TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) { EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); // |DetermineMaxTokenLength()| interface states that |max_token_length| should // not change on failure. - EXPECT_EQ(100, max_token_length); + EXPECT_EQ(100u, max_token_length); } TEST(HttpAuthSSPITest, ParseChallenge_FirstRound) { diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc index 28431e4..9b7b684 100644 --- a/net/udp/udp_socket_unittest.cc +++ b/net/udp/udp_socket_unittest.cc @@ -715,8 +715,8 @@ BOOL WINAPI FakeQOSAddSocketToFlow(HANDLE handle, PQOS_FLOWID flow_id) { EXPECT_EQ(kFakeHandle, handle); EXPECT_EQ(NULL, addr); - EXPECT_EQ(QOS_NON_ADAPTIVE_FLOW, flags); - EXPECT_EQ(0, *flow_id); + EXPECT_EQ(static_cast<DWORD>(QOS_NON_ADAPTIVE_FLOW), flags); + EXPECT_EQ(0u, *flow_id); *flow_id = kFakeFlowId; return true; } @@ -726,9 +726,9 @@ BOOL WINAPI FakeQOSRemoveSocketFromFlow(HANDLE handle, QOS_FLOWID flowid, DWORD reserved) { EXPECT_EQ(kFakeHandle, handle); - EXPECT_EQ(NULL, socket); + EXPECT_EQ(0u, socket); EXPECT_EQ(kFakeFlowId, flowid); - EXPECT_EQ(0, reserved); + EXPECT_EQ(0u, reserved); return true; } @@ -746,7 +746,7 @@ BOOL WINAPI FakeQOSSetFlow(HANDLE handle, EXPECT_EQ(sizeof(DWORD), size); EXPECT_EQ(g_expected_dscp, *reinterpret_cast<DWORD*>(data)); EXPECT_EQ(kFakeFlowId, flow_id); - EXPECT_EQ(0, reserved); + EXPECT_EQ(0u, reserved); EXPECT_EQ(NULL, overlapped); return true; } diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index 6b2b20f..171d97c 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc @@ -152,7 +152,7 @@ TEST_F(PrintingContextTest, PrintAll) { base::Unretained(this))); EXPECT_EQ(PrintingContext::OK, result()); PrintSettings settings = context.settings(); - EXPECT_EQ(settings.ranges().size(), 0); + EXPECT_EQ(0u, settings.ranges().size()); } TEST_F(PrintingContextTest, Base) { diff --git a/remoting/host/local_input_monitor_win.cc b/remoting/host/local_input_monitor_win.cc index 74975ec..e6100b7 100644 --- a/remoting/host/local_input_monitor_win.cc +++ b/remoting/host/local_input_monitor_win.cc @@ -165,7 +165,7 @@ LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { nullptr, &size, sizeof(RAWINPUTHEADER)); - if (result == -1) { + if (result == static_cast<UINT>(-1)) { PLOG(ERROR) << "GetRawInputData() failed"; return 0; } @@ -178,7 +178,7 @@ LRESULT LocalInputMonitorWin::Core::OnInput(HRAWINPUT input_handle) { buffer.get(), &size, sizeof(RAWINPUTHEADER)); - if (result == -1) { + if (result == static_cast<UINT>(-1)) { PLOG(ERROR) << "GetRawInputData() failed"; return 0; } diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc index 7026794..58c6bd5 100644 --- a/remoting/host/setup/daemon_controller_delegate_win.cc +++ b/remoting/host/setup/daemon_controller_delegate_win.cc @@ -179,8 +179,7 @@ bool WriteConfig(const std::string& content) { // Extract the unprivileged fields from the configuration. base::DictionaryValue unprivileged_config_dict; - for (int i = 0; i < arraysize(kUnprivilegedConfigKeys); ++i) { - const char* key = kUnprivilegedConfigKeys[i]; + for (const char* key : kUnprivilegedConfigKeys) { base::string16 value; if (config_dict->GetString(key, &value)) { unprivileged_config_dict.SetString(key, value); @@ -382,7 +381,7 @@ void DaemonControllerDelegateWin::UpdateConfig( scoped_ptr<base::DictionaryValue> config, const DaemonController::CompletionCallback& done) { // Check for bad keys. - for (int i = 0; i < arraysize(kReadonlyKeys); ++i) { + for (size_t i = 0; i < arraysize(kReadonlyKeys); ++i) { if (config->HasKey(kReadonlyKeys[i])) { LOG(ERROR) << "Cannot update config: '" << kReadonlyKeys[i] << "' is read only."; diff --git a/rlz/win/lib/machine_deal.cc b/rlz/win/lib/machine_deal.cc index afb935f..5b5d007 100644 --- a/rlz/win/lib/machine_deal.cc +++ b/rlz/win/lib/machine_deal.cc @@ -57,7 +57,7 @@ bool IsGoodDccChar(char ch) { // reasonable size. It also assumes that normalized_dcc is at least // kMaxDccLength+1 long. void NormalizeDcc(const char* raw_dcc, char* normalized_dcc) { - int index = 0; + size_t index = 0; for (; raw_dcc[index] != 0 && index < rlz_lib::kMaxDccLength; ++index) { char current = raw_dcc[index]; if (IsGoodDccChar(current)) { diff --git a/rlz/win/lib/process_info.cc b/rlz/win/lib/process_info.cc index cbab44a0..8eceb35 100644 --- a/rlz/win/lib/process_info.cc +++ b/rlz/win/lib/process_info.cc @@ -59,7 +59,7 @@ bool GetUserGroup(long* group) { DOMAIN_ALIAS_RID_POWER_USERS}; SID_IDENTIFIER_AUTHORITY nt_authority = {SECURITY_NT_AUTHORITY}; - for (int i = 0; i < arraysize(user_groups) && *group == 0; ++i) { + for (size_t i = 0; i < arraysize(user_groups) && *group == 0; ++i) { PSID current_group; if (AllocateAndInitializeSid(&nt_authority, 2, SECURITY_BUILTIN_DOMAIN_RID, diff --git a/rlz/win/lib/rlz_value_store_registry.cc b/rlz/win/lib/rlz_value_store_registry.cc index 4a133eb..b88707b 100644 --- a/rlz/win/lib/rlz_value_store_registry.cc +++ b/rlz/win/lib/rlz_value_store_registry.cc @@ -349,7 +349,7 @@ void RlzValueStoreRegistry::CollectGarbage() { kPingTimesSubkeyName }; - for (int i = 0; i < arraysize(subkeys); i++) { + for (size_t i = 0; i < arraysize(subkeys); i++) { std::string subkey_name; base::StringAppendF(&subkey_name, "%s\\%s", kLibKeyName, subkeys[i]); AppendBrandToString(&subkey_name); diff --git a/sandbox/win/src/handle_closer_agent.cc b/sandbox/win/src/handle_closer_agent.cc index ae5c4d1..b26fb15 100644 --- a/sandbox/win/src/handle_closer_agent.cc +++ b/sandbox/win/src/handle_closer_agent.cc @@ -120,7 +120,7 @@ void HandleCloserAgent::InitializeHandlesToClose(bool* is_csrss_connected) { DCHECK(reinterpret_cast<base::char16*>(entry) >= input); DCHECK(reinterpret_cast<base::char16*>(entry) - input < - sizeof(size_t) / sizeof(base::char16)); + static_cast<ptrdiff_t>(sizeof(size_t) / sizeof(base::char16))); } // Clean up the memory we copied over. diff --git a/ui/base/dragdrop/os_exchange_data_win_unittest.cc b/ui/base/dragdrop/os_exchange_data_win_unittest.cc index 0104307..1db2c16 100644 --- a/ui/base/dragdrop/os_exchange_data_win_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_win_unittest.cc @@ -193,7 +193,7 @@ TEST(OSExchangeDataWinTest, EnumerationViaCOM) { FORMATETC elements_array[1]; EXPECT_EQ(S_OK, enumerator->Next(1, reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); - EXPECT_EQ(1, retrieved); + EXPECT_EQ(1u, retrieved); EXPECT_EQ(text_x_moz_url, elements_array[0].cfFormat); } @@ -213,7 +213,7 @@ TEST(OSExchangeDataWinTest, EnumerationViaCOM) { FORMATETC elements_array[2]; EXPECT_EQ(S_OK, enumerator->Next(2, reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); - EXPECT_EQ(2, retrieved); + EXPECT_EQ(2u, retrieved); EXPECT_EQ(text_x_moz_url, elements_array[0].cfFormat); EXPECT_EQ(cfstr_file_group_descriptor, elements_array[1].cfFormat); } @@ -226,7 +226,7 @@ TEST(OSExchangeDataWinTest, EnumerationViaCOM) { FORMATETC elements_array[1]; EXPECT_EQ(S_OK, enumerator->Next(1, reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); - EXPECT_EQ(1, retrieved); + EXPECT_EQ(1u, retrieved); EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat); } @@ -244,7 +244,7 @@ TEST(OSExchangeDataWinTest, EnumerationViaCOM) { FORMATETC elements_array[1]; EXPECT_EQ(S_OK, cloned_enumerator->Next(1, reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); - EXPECT_EQ(1, retrieved); + EXPECT_EQ(1u, retrieved); EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat); } @@ -253,7 +253,7 @@ TEST(OSExchangeDataWinTest, EnumerationViaCOM) { FORMATETC elements_array[1]; EXPECT_EQ(S_OK, enumerator->Next(1, reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); - EXPECT_EQ(1, retrieved); + EXPECT_EQ(1u, retrieved); EXPECT_EQ(text_x_moz_url, elements_array[0].cfFormat); } } diff --git a/ui/base/ime/remote_input_method_win_unittest.cc b/ui/base/ime/remote_input_method_win_unittest.cc index 0970de0..c234607 100644 --- a/ui/base/ime/remote_input_method_win_unittest.cc +++ b/ui/base/ime/remote_input_method_win_unittest.cc @@ -335,10 +335,10 @@ TEST(RemoteInputMethodWinTest, SetFocusedTextInputClient) { // Initial state must be synced. EXPECT_TRUE(mock_remote_delegate.text_input_client_updated_called()); - ASSERT_EQ(1, mock_remote_delegate.composition_character_bounds().size()); + ASSERT_EQ(1u, mock_remote_delegate.composition_character_bounds().size()); EXPECT_EQ(gfx::Rect(10, 0, 10, 20), mock_remote_delegate.composition_character_bounds()[0]); - ASSERT_EQ(1, mock_remote_delegate.input_scopes().size()); + ASSERT_EQ(1u, mock_remote_delegate.input_scopes().size()); EXPECT_EQ(IS_URL, mock_remote_delegate.input_scopes()[0]); // State must be cleared by SetFocusedTextInputClient(NULL). @@ -366,10 +366,10 @@ TEST(RemoteInputMethodWinTest, DetachTextInputClient) { // Initial state must be synced. EXPECT_TRUE(mock_remote_delegate.text_input_client_updated_called()); - ASSERT_EQ(1, mock_remote_delegate.composition_character_bounds().size()); + ASSERT_EQ(1u, mock_remote_delegate.composition_character_bounds().size()); EXPECT_EQ(gfx::Rect(10, 0, 10, 20), mock_remote_delegate.composition_character_bounds()[0]); - ASSERT_EQ(1, mock_remote_delegate.input_scopes().size()); + ASSERT_EQ(1u, mock_remote_delegate.input_scopes().size()); EXPECT_EQ(IS_URL, mock_remote_delegate.input_scopes()[0]); // State must be cleared by DetachTextInputClient @@ -399,7 +399,7 @@ TEST(RemoteInputMethodWinTest, OnCaretBoundsChanged) { // Initial state must be synced. EXPECT_TRUE(mock_remote_delegate.text_input_client_updated_called()); - ASSERT_EQ(1, mock_remote_delegate.composition_character_bounds().size()); + ASSERT_EQ(1u, mock_remote_delegate.composition_character_bounds().size()); EXPECT_EQ(gfx::Rect(10, 0, 10, 20), mock_remote_delegate.composition_character_bounds()[0]); @@ -414,7 +414,7 @@ TEST(RemoteInputMethodWinTest, OnCaretBoundsChanged) { mock_text_input_client.set_caret_bounds(gfx::Rect(10, 20, 30, 40)); input_method->OnCaretBoundsChanged(&mock_text_input_client); EXPECT_TRUE(mock_remote_delegate.text_input_client_updated_called()); - ASSERT_EQ(1, mock_remote_delegate.composition_character_bounds().size()); + ASSERT_EQ(1u, mock_remote_delegate.composition_character_bounds().size()); EXPECT_EQ(gfx::Rect(10, 20, 30, 40), mock_remote_delegate.composition_character_bounds()[0]); @@ -484,7 +484,7 @@ TEST(RemoteInputMethodWinTest, OnTextInputTypeChanged) { // Initial state must be synced. EXPECT_TRUE(mock_remote_delegate.text_input_client_updated_called()); - ASSERT_EQ(1, mock_remote_delegate.input_scopes().size()); + ASSERT_EQ(1u, mock_remote_delegate.input_scopes().size()); EXPECT_EQ(IS_URL, mock_remote_delegate.input_scopes()[0]); // Check TEXT_INPUT_TYPE_NONE is handled. @@ -616,7 +616,7 @@ TEST(RemoteInputMethodWinTest, DispatchKeyEvent_FabricatedKeyDown) { input_method->DispatchKeyEvent(&fabricated_keydown); EXPECT_TRUE(fabricated_keydown.handled()); EXPECT_TRUE(mock_text_input_client.inserted_text().empty()); - ASSERT_EQ(1, delegate_.fabricated_key_events().size()); + ASSERT_EQ(1u, delegate_.fabricated_key_events().size()); EXPECT_EQ(L'A', delegate_.fabricated_key_events()[0]); delegate_.Reset(); mock_text_input_client.Reset(); @@ -632,7 +632,7 @@ TEST(RemoteInputMethodWinTest, DispatchKeyEvent_FabricatedKeyDown) { input_method->DispatchKeyEvent(&fabricated_keydown); EXPECT_TRUE(fabricated_keydown.handled()); EXPECT_TRUE(mock_text_input_client.inserted_text().empty()); - ASSERT_EQ(1, delegate_.fabricated_key_events().size()); + ASSERT_EQ(1u, delegate_.fabricated_key_events().size()); EXPECT_EQ(L'A', delegate_.fabricated_key_events()[0]); delegate_.Reset(); mock_text_input_client.Reset(); @@ -643,7 +643,7 @@ TEST(RemoteInputMethodWinTest, DispatchKeyEvent_FabricatedKeyDown) { input_method->DispatchKeyEvent(&fabricated_keydown); EXPECT_TRUE(fabricated_keydown.handled()); EXPECT_TRUE(mock_text_input_client.inserted_text().empty()); - ASSERT_EQ(1, delegate_.fabricated_key_events().size()); + ASSERT_EQ(1u, delegate_.fabricated_key_events().size()); EXPECT_EQ(L'A', delegate_.fabricated_key_events()[0]); delegate_.Reset(); mock_text_input_client.Reset(); @@ -718,7 +718,7 @@ TEST(RemoteInputMethodWinTest, OnCompositionChanged) { // TextInputClient is not focused yet here. private_ptr->OnCompositionChanged(composition_text); - EXPECT_EQ(0, mock_text_input_client.call_count_set_composition_text()); + EXPECT_EQ(0u, mock_text_input_client.call_count_set_composition_text()); delegate_.Reset(); mock_text_input_client.Reset(); @@ -727,7 +727,7 @@ TEST(RemoteInputMethodWinTest, OnCompositionChanged) { // TextInputClient is now focused here. private_ptr->OnCompositionChanged(composition_text); - EXPECT_EQ(1, mock_text_input_client.call_count_set_composition_text()); + EXPECT_EQ(1u, mock_text_input_client.call_count_set_composition_text()); delegate_.Reset(); mock_text_input_client.Reset(); } @@ -749,8 +749,8 @@ TEST(RemoteInputMethodWinTest, OnTextCommitted) { mock_text_input_client.set_text_input_type(TEXT_INPUT_TYPE_TEXT); private_ptr->OnTextCommitted(committed_text); - EXPECT_EQ(0, mock_text_input_client.call_count_insert_char()); - EXPECT_EQ(0, mock_text_input_client.call_count_insert_text()); + EXPECT_EQ(0u, mock_text_input_client.call_count_insert_char()); + EXPECT_EQ(0u, mock_text_input_client.call_count_insert_text()); EXPECT_EQ(L"", mock_text_input_client.inserted_text()); delegate_.Reset(); mock_text_input_client.Reset(); @@ -761,8 +761,8 @@ TEST(RemoteInputMethodWinTest, OnTextCommitted) { mock_text_input_client.set_text_input_type(TEXT_INPUT_TYPE_TEXT); private_ptr->OnTextCommitted(committed_text); - EXPECT_EQ(0, mock_text_input_client.call_count_insert_char()); - EXPECT_EQ(1, mock_text_input_client.call_count_insert_text()); + EXPECT_EQ(0u, mock_text_input_client.call_count_insert_char()); + EXPECT_EQ(1u, mock_text_input_client.call_count_insert_text()); EXPECT_EQ(committed_text, mock_text_input_client.inserted_text()); delegate_.Reset(); mock_text_input_client.Reset(); @@ -773,7 +773,7 @@ TEST(RemoteInputMethodWinTest, OnTextCommitted) { private_ptr->OnTextCommitted(committed_text); EXPECT_EQ(committed_text.size(), mock_text_input_client.call_count_insert_char()); - EXPECT_EQ(0, mock_text_input_client.call_count_insert_text()); + EXPECT_EQ(0u, mock_text_input_client.call_count_insert_text()); EXPECT_EQ(committed_text, mock_text_input_client.inserted_text()); delegate_.Reset(); mock_text_input_client.Reset(); diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc index 1e6b71d..8cdff0a 100644 --- a/ui/gfx/gdi_util.cc +++ b/ui/gfx/gdi_util.cc @@ -133,7 +133,7 @@ void StretchDIBits(HDC hdc, int dest_x, int dest_y, int dest_w, int dest_h, src_x, bottom_up_src_y, src_w, src_h, pixels, bitmap_info, DIB_RGB_COLORS, SRCCOPY); } - DCHECK(rv != GDI_ERROR); + DCHECK(rv != static_cast<int>(GDI_ERROR)); } } // namespace gfx diff --git a/ui/gfx/icon_util_unittest.cc b/ui/gfx/icon_util_unittest.cc index f47d190..d72c2cc 100644 --- a/ui/gfx/icon_util_unittest.cc +++ b/ui/gfx/icon_util_unittest.cc @@ -417,7 +417,7 @@ TEST_F(IconUtilTest, TestCreateImageFamilyFromIconResource) { images.push_back(image); // Assert that the family contains all of the images from the icon resource. - EXPECT_EQ(5, images.size()); + EXPECT_EQ(5u, images.size()); EXPECT_EQ(16, images[0].Width()); EXPECT_EQ(24, images[1].Width()); EXPECT_EQ(32, images[2].Width()); diff --git a/ui/gfx/platform_font_win_unittest.cc b/ui/gfx/platform_font_win_unittest.cc index 4c4c50d..10050f6 100644 --- a/ui/gfx/platform_font_win_unittest.cc +++ b/ui/gfx/platform_font_win_unittest.cc @@ -127,25 +127,24 @@ TEST(PlatformFontWinTest, Metrics_SkiaVersusGDI) { base::win::ScopedGetDC screen_dc(NULL); gfx::ScopedSetMapMode mode(screen_dc, MM_TEXT); - for (int i = 0; i < arraysize(fonts); ++i) { + for (const FontInfo& font : fonts) { LOGFONT font_info = {0}; - font_info.lfHeight = -fonts[i].font_size; + font_info.lfHeight = -font.font_size; font_info.lfWeight = FW_NORMAL; - wcscpy_s(font_info.lfFaceName, - fonts[i].font_name.length() + 1, - fonts[i].font_name.c_str()); + wcscpy_s(font_info.lfFaceName, font.font_name.length() + 1, + font.font_name.c_str()); - HFONT font = CreateFontIndirect(&font_info); + HFONT hFont = CreateFontIndirect(&font_info); TEXTMETRIC font_metrics; - PlatformFontWin::GetTextMetricsForFont(screen_dc, font, &font_metrics); + PlatformFontWin::GetTextMetricsForFont(screen_dc, hFont, &font_metrics); scoped_refptr<PlatformFontWin::HFontRef> h_font_gdi( - PlatformFontWin::CreateHFontRefFromGDI(font, font_metrics)); + PlatformFontWin::CreateHFontRefFromGDI(hFont, font_metrics)); scoped_refptr<PlatformFontWin::HFontRef> h_font_skia( - PlatformFontWin::CreateHFontRefFromSkia(font, font_metrics)); + PlatformFontWin::CreateHFontRefFromSkia(hFont, font_metrics)); EXPECT_EQ(h_font_gdi->font_size(), h_font_skia->font_size()); EXPECT_EQ(h_font_gdi->style(), h_font_skia->style()); @@ -185,24 +184,23 @@ TEST(PlatformFontWinTest, DirectWriteFontSubstitution) { base::win::ScopedGetDC screen_dc(NULL); gfx::ScopedSetMapMode mode(screen_dc, MM_TEXT); - for (int i = 0; i < arraysize(fonts); ++i) { + for (const FontInfo& font : fonts) { LOGFONT font_info = {0}; font_info.lfHeight = -10; font_info.lfWeight = FW_NORMAL; - wcscpy_s(font_info.lfFaceName, - fonts[i].font_name.length() + 1, - fonts[i].font_name.c_str()); + wcscpy_s(font_info.lfFaceName, font.font_name.length() + 1, + font.font_name.c_str()); - HFONT font = CreateFontIndirect(&font_info); + HFONT hFont = CreateFontIndirect(&font_info); TEXTMETRIC font_metrics; - PlatformFontWin::GetTextMetricsForFont(screen_dc, font, &font_metrics); + PlatformFontWin::GetTextMetricsForFont(screen_dc, hFont, &font_metrics); scoped_refptr<PlatformFontWin::HFontRef> h_font_skia( - PlatformFontWin::CreateHFontRefFromSkia(font, font_metrics)); + PlatformFontWin::CreateHFontRefFromSkia(hFont, font_metrics)); - EXPECT_EQ(fonts[i].expected_font_name, h_font_skia->font_name()); + EXPECT_EQ(font.expected_font_name, h_font_skia->font_name()); } } diff --git a/ui/gfx/range/range_win_unittest.cc b/ui/gfx/range/range_win_unittest.cc index f7a442c..d15375b 100644 --- a/ui/gfx/range/range_win_unittest.cc +++ b/ui/gfx/range/range_win_unittest.cc @@ -45,8 +45,8 @@ TEST(RangeTest, ToCHARRANGE) { TEST(RangeTest, ReversedToCHARRANGE) { gfx::Range r(20, 10); CHARRANGE cr = r.ToCHARRANGE(); - EXPECT_EQ(20U, cr.cpMin); - EXPECT_EQ(10U, cr.cpMax); + EXPECT_EQ(20, cr.cpMin); + EXPECT_EQ(10, cr.cpMax); } TEST(RangeTest, FromCHARRANGEInvalid) { diff --git a/ui/gfx/screen_win_unittest.cc b/ui/gfx/screen_win_unittest.cc index 2bb4f7b..5e6f961 100644 --- a/ui/gfx/screen_win_unittest.cc +++ b/ui/gfx/screen_win_unittest.cc @@ -56,7 +56,7 @@ TEST_F(ScreenWinTest, SingleDisplay1x) { std::vector<gfx::Display> displays = ScreenWin::GetDisplaysForMonitorInfos(monitor_infos); - ASSERT_EQ(1, displays.size()); + ASSERT_EQ(1u, displays.size()); EXPECT_EQ(gfx::Rect(0, 0, 1920, 1200), displays[0].bounds()); EXPECT_EQ(gfx::Rect(0, 0, 1920, 1100), displays[0].work_area()); } @@ -71,7 +71,7 @@ TEST_F(ScreenWinTest, SingleDisplay2x) { std::vector<gfx::Display> displays = ScreenWin::GetDisplaysForMonitorInfos(monitor_infos); - ASSERT_EQ(1, displays.size()); + ASSERT_EQ(1u, displays.size()); EXPECT_EQ(gfx::Rect(0, 0, 960, 600), displays[0].bounds()); EXPECT_EQ(gfx::Rect(0, 0, 960, 550), displays[0].work_area()); } diff --git a/win8/metro_driver/file_picker_ash.h b/win8/metro_driver/file_picker_ash.h index 0862b69..c08d293 100644 --- a/win8/metro_driver/file_picker_ash.h +++ b/win8/metro_driver/file_picker_ash.h @@ -83,9 +83,7 @@ class OpenFilePickerSession : public FilePickerSessionBase { return filenames_; } - const bool allow_multi_select() const { - return allow_multi_select_; - } + bool allow_multi_select() const { return allow_multi_select_; } private: HRESULT StartFilePicker() override; |