Ignore FILE_ATTRIBUTE_NOT_CONTENT_INDEXED for base unit tests.

FILE_ATTRIBUTE_NOT_CONTENT_INDEXED may or may not be set on a temp
directory depending on the OS version and location of the directory.

BUG=455470

Review URL: https://codereview.chromium.org/906173005

Cr-Commit-Position: refs/heads/master@{#315391}


CrOS-Libchrome-Original-Commit: 8e197f924af30da5a799f133669ef64cf974c36f
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
index 313ed03..de38083 100644
--- a/base/files/file_util_unittest.cc
+++ b/base/files/file_util_unittest.cc
@@ -1388,19 +1388,15 @@
       path.value().c_str(),
       read_only ? (attrs | FILE_ATTRIBUTE_READONLY) :
           (attrs & ~FILE_ATTRIBUTE_READONLY)));
-  // Files in the temporary directory should not be indexed ever. If this
-  // assumption change, fix this unit test accordingly.
-  // FILE_ATTRIBUTE_NOT_CONTENT_INDEXED doesn't exist on XP.
+
   DWORD expected = read_only ?
       ((attrs & (FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_DIRECTORY)) |
           FILE_ATTRIBUTE_READONLY) :
       (attrs & (FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_DIRECTORY));
-  // TODO(ripp@yandex-team.ru): this seems out of place here. If we really think
-  // it is important to verify that temp files are not indexed there should be
-  // a dedicated test for that (create a file, inspect the attributes)
-  if (win::GetVersion() >= win::VERSION_VISTA)
-    expected |= FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
-  attrs = GetFileAttributes(path.value().c_str());
+
+  // Ignore FILE_ATTRIBUTE_NOT_CONTENT_INDEXED if present.
+  attrs = GetFileAttributes(path.value().c_str()) &
+          ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
   ASSERT_EQ(expected, attrs);
 #else
   // On all other platforms, it involves removing/setting the write bit.