1diff -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectations/angle_config.h
2--- gpu_test_expectations_reverted/angle_config.h	1969-12-31 19:00:00.000000000 -0500
3+++ gpu_test_expectations/angle_config.h	2016-08-23 13:50:18.282742505 -0400
4@@ -0,0 +1,66 @@
5+//
6+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
7+// Use of this source code is governed by a BSD-style license that can be
8+// found in the LICENSE file.
9+//
10+// angle_config.h:
11+//   Helpers for importing the gpu test expectations package from Chrome.
12+//
13+
14+#ifndef GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
15+#define GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
16+
17+#include <stdint.h>
18+
19+#include <iostream>
20+
21+#include "common/debug.h"
22+#include "common/string_utils.h"
23+
24+#define DCHECK_EQ(A,B) ASSERT((A) == (B))
25+#define DCHECK_NE(A,B) ASSERT((A) != (B))
26+#define DCHECK(X) ASSERT(X)
27+#define LOG(X) std::cerr
28+
29+#define GPU_EXPORT
30+
31+typedef int32_t int32;
32+typedef uint32_t uint32;
33+typedef int64_t int64;
34+typedef uint64_t uint64;
35+
36+// Shim Chromium's base by importing functions in the base namespace.
37+namespace base
38+{
39+    using angle::kWhitespaceASCII;
40+    using angle::TRIM_WHITESPACE;
41+    using angle::KEEP_WHITESPACE;
42+    using angle::SPLIT_WANT_ALL;
43+    using angle::SPLIT_WANT_NONEMPTY;
44+    using angle::SplitString;
45+    using angle::SplitStringAlongWhitespace;
46+    using angle::HexStringToUInt;
47+    using angle::ReadFileToString;
48+
49+    // StringPrintf is called differently in ANGLE but using cannot change
50+    // the name of the imported function. Use a define to change the name.
51+    using ::FormatString;
52+    #define StringPrintf FormatString
53+}
54+
55+// TODO(jmadill): other platforms
56+// clang-format off
57+#if defined(_WIN32) || defined(_WIN64)
58+#    define OS_WIN
59+#elif defined(ANDROID)
60+#    define OS_ANDROID
61+#elif defined(__linux__)
62+#    define OS_LINUX
63+#elif defined(__APPLE__)
64+#    define OS_MACOSX
65+#else
66+#    error "Unsupported platform"
67+#endif
68+// clang-format on
69+
70+#endif
71diff -rupN gpu_test_expectations_reverted/gpu_info.cc gpu_test_expectations/gpu_info.cc
72--- gpu_test_expectations_reverted/gpu_info.cc	2016-08-12 21:23:54.884132405 -0400
73+++ gpu_test_expectations/gpu_info.cc	2015-11-30 21:54:30.239267635 -0500
74@@ -2,7 +2,7 @@
75 // Use of this source code is governed by a BSD-style license that can be
76 // found in the LICENSE file.
77
78-#include "gpu/config/gpu_info.h"
79+#include "gpu_info.h"
80
81 namespace {
82
83@@ -17,31 +17,6 @@ void EnumerateGPUDevice(const gpu::GPUIn
84   enumerator->EndGPUDevice();
85 }
86
87-void EnumerateVideoDecodeAcceleratorSupportedProfile(
88-    const gpu::VideoDecodeAcceleratorSupportedProfile& profile,
89-    gpu::GPUInfo::Enumerator* enumerator) {
90-  enumerator->BeginVideoDecodeAcceleratorSupportedProfile();
91-  enumerator->AddInt("profile", profile.profile);
92-  enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
93-  enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
94-  enumerator->AddInt("minResolutionWidth", profile.min_resolution.width());
95-  enumerator->AddInt("minResolutionHeight", profile.min_resolution.height());
96-  enumerator->EndVideoDecodeAcceleratorSupportedProfile();
97-}
98-
99-void EnumerateVideoEncodeAcceleratorSupportedProfile(
100-    const gpu::VideoEncodeAcceleratorSupportedProfile& profile,
101-    gpu::GPUInfo::Enumerator* enumerator) {
102-  enumerator->BeginVideoEncodeAcceleratorSupportedProfile();
103-  enumerator->AddInt("profile", profile.profile);
104-  enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
105-  enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
106-  enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator);
107-  enumerator->AddInt("maxFramerateDenominator",
108-                     profile.max_framerate_denominator);
109-  enumerator->EndVideoEncodeAcceleratorSupportedProfile();
110-}
111-
112 }  // namespace
113
114 namespace gpu {
115@@ -68,9 +43,6 @@ GPUInfo::GPUInfo()
116       in_process_gpu(true),
117       basic_info_state(kCollectInfoNone),
118       context_info_state(kCollectInfoNone),
119-#if defined(OS_WIN)
120-      dx_diagnostics_info_state(kCollectInfoNone),
121-#endif
122       jpeg_decode_accelerator_supported(false) {
123 }
124
125@@ -78,11 +50,9 @@ GPUInfo::~GPUInfo() { }
126
127 void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
128   struct GPUInfoKnownFields {
129-    base::TimeDelta initialization_time;
130     bool optimus;
131     bool amd_switchable;
132     bool lenovo_dcute;
133-    Version display_link_version;
134     GPUDevice gpu;
135     std::vector<GPUDevice> secondary_gpus;
136     uint64 adapter_luid;
137@@ -110,14 +80,6 @@ void GPUInfo::EnumerateFields(Enumerator
138     bool in_process_gpu;
139     CollectInfoResult basic_info_state;
140     CollectInfoResult context_info_state;
141-#if defined(OS_WIN)
142-    CollectInfoResult dx_diagnostics_info_state;
143-    DxDiagNode dx_diagnostics;
144-#endif
145-    VideoDecodeAcceleratorSupportedProfiles
146-        video_decode_accelerator_supported_profiles;
147-    VideoEncodeAcceleratorSupportedProfiles
148-        video_encode_accelerator_supported_profiles;
149     bool jpeg_decode_accelerator_supported;
150   };
151
152@@ -136,15 +98,9 @@ void GPUInfo::EnumerateFields(Enumerator
153     EnumerateGPUDevice(secondary_gpu, enumerator);
154
155   enumerator->BeginAuxAttributes();
156-  enumerator->AddTimeDeltaInSecondsF("initializationTime",
157-                                     initialization_time);
158   enumerator->AddBool("optimus", optimus);
159   enumerator->AddBool("amdSwitchable", amd_switchable);
160   enumerator->AddBool("lenovoDcute", lenovo_dcute);
161-  if (display_link_version.IsValid()) {
162-    enumerator->AddString("displayLinkVersion",
163-                          display_link_version.GetString());
164-  }
165   enumerator->AddInt64("adapterLuid", adapter_luid);
166   enumerator->AddString("driverVendor", driver_vendor);
167   enumerator->AddString("driverVersion", driver_version);
168@@ -171,14 +127,7 @@ void GPUInfo::EnumerateFields(Enumerator
169   enumerator->AddBool("inProcessGpu", in_process_gpu);
170   enumerator->AddInt("basicInfoState", basic_info_state);
171   enumerator->AddInt("contextInfoState", context_info_state);
172-#if defined(OS_WIN)
173-  enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state);
174-#endif
175   // TODO(kbr): add dx_diagnostics on Windows.
176-  for (const auto& profile : video_decode_accelerator_supported_profiles)
177-    EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator);
178-  for (const auto& profile : video_encode_accelerator_supported_profiles)
179-    EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator);
180   enumerator->AddBool("jpegDecodeAcceleratorSupported",
181       jpeg_decode_accelerator_supported);
182   enumerator->EndAuxAttributes();
183diff -rupN gpu_test_expectations_reverted/gpu_info.h gpu_test_expectations/gpu_info.h
184--- gpu_test_expectations_reverted/gpu_info.h	2016-08-12 21:23:54.884132405 -0400
185+++ gpu_test_expectations/gpu_info.h	2015-11-30 21:54:30.239267635 -0500
186@@ -11,13 +11,7 @@
187 #include <string>
188 #include <vector>
189
190-#include "base/basictypes.h"
191-#include "base/time/time.h"
192-#include "base/version.h"
193-#include "build/build_config.h"
194-#include "gpu/config/dx_diag_node.h"
195-#include "gpu/gpu_export.h"
196-#include "ui/gfx/geometry/size.h"
197+#include "angle_config.h"
198
199 namespace gpu {
200
201@@ -54,25 +48,6 @@ enum VideoCodecProfile {
202   VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY,
203 };
204
205-// Specification of a decoding profile supported by a hardware decoder.
206-struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile {
207-  VideoCodecProfile profile;
208-  gfx::Size max_resolution;
209-  gfx::Size min_resolution;
210-};
211-using VideoDecodeAcceleratorSupportedProfiles =
212-    std::vector<VideoDecodeAcceleratorSupportedProfile>;
213-
214-// Specification of an encoding profile supported by a hardware encoder.
215-struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile {
216-  VideoCodecProfile profile;
217-  gfx::Size max_resolution;
218-  uint32 max_framerate_numerator;
219-  uint32 max_framerate_denominator;
220-};
221-using VideoEncodeAcceleratorSupportedProfiles =
222-    std::vector<VideoEncodeAcceleratorSupportedProfile>;
223-
224 struct GPU_EXPORT GPUInfo {
225   struct GPU_EXPORT GPUDevice {
226     GPUDevice();
227@@ -104,10 +79,6 @@ struct GPU_EXPORT GPUInfo {
228     return !can_lose_context && !software_rendering;
229   }
230
231-  // The amount of time taken to get from the process starting to the message
232-  // loop being pumped.
233-  base::TimeDelta initialization_time;
234-
235   // Computer has NVIDIA Optimus
236   bool optimus;
237
238@@ -117,10 +88,6 @@ struct GPU_EXPORT GPUInfo {
239   // Lenovo dCute is installed. http://crbug.com/181665.
240   bool lenovo_dcute;
241
242-  // Version of DisplayLink driver installed. Zero if not installed.
243-  // http://crbug.com/177611.
244-  Version display_link_version;
245-
246   // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
247   GPUDevice gpu;
248
249@@ -213,17 +180,7 @@ struct GPU_EXPORT GPUInfo {
250   // if the collection fails or not.
251   CollectInfoResult basic_info_state;
252   CollectInfoResult context_info_state;
253-#if defined(OS_WIN)
254-  CollectInfoResult dx_diagnostics_info_state;
255
256-  // The information returned by the DirectX Diagnostics Tool.
257-  DxDiagNode dx_diagnostics;
258-#endif
259-
260-  VideoDecodeAcceleratorSupportedProfiles
261-      video_decode_accelerator_supported_profiles;
262-  VideoEncodeAcceleratorSupportedProfiles
263-      video_encode_accelerator_supported_profiles;
264   bool jpeg_decode_accelerator_supported;
265
266   // Note: when adding new members, please remember to update EnumerateFields
267@@ -243,8 +200,6 @@ struct GPU_EXPORT GPUInfo {
268     virtual void AddInt(const char* name, int value) = 0;
269     virtual void AddString(const char* name, const std::string& value) = 0;
270     virtual void AddBool(const char* name, bool value) = 0;
271-    virtual void AddTimeDeltaInSecondsF(const char* name,
272-                                        const base::TimeDelta& value) = 0;
273
274     // Markers indicating that a GPUDevice is being described.
275     virtual void BeginGPUDevice() = 0;
276diff -rupN gpu_test_expectations_reverted/gpu_test_config.cc gpu_test_expectations/gpu_test_config.cc
277--- gpu_test_expectations_reverted/gpu_test_config.cc	2016-08-12 21:23:54.884132405 -0400
278+++ gpu_test_expectations/gpu_test_config.cc	2016-09-09 16:40:05.597864465 -0400
279@@ -2,20 +2,205 @@
280 // Use of this source code is governed by a BSD-style license that can be
281 // found in the LICENSE file.
282
283-#include "gpu/config/gpu_test_config.h"
284+#include "gpu_test_config.h"
285
286-#include "base/logging.h"
287-#include "base/sys_info.h"
288-#include "gpu/config/gpu_info.h"
289-#include "gpu/config/gpu_info_collector.h"
290-#include "gpu/config/gpu_test_expectations_parser.h"
291+#include "gpu_info.h"
292+#include "gpu_test_expectations_parser.h"
293+
294+#if defined(OS_LINUX)
295+extern "C" {
296+#   include <pci/pci.h>
297+}
298+#endif
299
300 #if defined(OS_MACOSX)
301-#include "base/mac/mac_util.h"
302-#elif defined(OS_WIN)
303-#include "base/win/windows_version.h"
304+#include "gpu_test_config_mac.h"
305+#endif
306+
307+using namespace gpu;
308+
309+#if defined(OS_WIN)
310+
311+namespace base {
312+
313+namespace {
314+
315+// Disable the deprecated function warning for GetVersionEx
316+#pragma warning(disable: 4996)
317+
318+class SysInfo
319+{
320+  public:
321+    static void OperatingSystemVersionNumbers(
322+        int32 *major_version, int32 *minor_version, int32 *bugfix_version);
323+};
324+
325+// static
326+void SysInfo::OperatingSystemVersionNumbers(
327+    int32 *major_version, int32 *minor_version, int32 *bugfix_version)
328+{
329+  OSVERSIONINFOEX version_info = { sizeof version_info };
330+  ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
331+  *major_version = version_info.dwMajorVersion;
332+  *minor_version = version_info.dwMinorVersion;
333+  *bugfix_version = version_info.dwBuildNumber;
334+}
335+
336+} // anonymous namespace
337+
338+} // namespace base
339+
340+void DeviceIDToVendorAndDevice(const std::string& id,
341+                               uint32* vendor_id,
342+                               uint32* device_id) {
343+  *vendor_id = 0;
344+  *device_id = 0;
345+  if (id.length() < 21)
346+    return;
347+  std::string vendor_id_string = id.substr(8, 4);
348+  std::string device_id_string = id.substr(17, 4);
349+  base::HexStringToUInt(vendor_id_string, vendor_id);
350+  base::HexStringToUInt(device_id_string, device_id);
351+}
352+
353+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
354+  DCHECK(vendor_id && device_id);
355+  *vendor_id = 0;
356+  *device_id = 0;
357+
358+  // Taken from http://developer.nvidia.com/object/device_ids.html
359+  DISPLAY_DEVICEA dd;
360+  dd.cb = sizeof(DISPLAY_DEVICEA);
361+  std::string id;
362+  for (int i = 0; EnumDisplayDevicesA(NULL, i, &dd, 0); ++i) {
363+    if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
364+      id = dd.DeviceID;
365+      break;
366+    }
367+  }
368+
369+  if (id.length() > 20) {
370+    DeviceIDToVendorAndDevice(id, vendor_id, device_id);
371+    if (*vendor_id != 0 && *device_id != 0)
372+      return kCollectInfoSuccess;
373+  }
374+  return kCollectInfoNonFatalFailure;
375+}
376+
377+#endif // defined(OS_WIN)
378+
379+#if defined(OS_LINUX)
380+
381+const uint32 kVendorIDIntel = 0x8086;
382+const uint32 kVendorIDNVidia = 0x10de;
383+const uint32 kVendorIDAMD = 0x1002;
384+
385+CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
386+  DCHECK(gpu_info);
387+
388+  struct pci_access* access = pci_alloc();
389+  DCHECK(access != NULL);
390+  pci_init(access);
391+  pci_scan_bus(access);
392+
393+  bool primary_gpu_identified = false;
394+  for (pci_dev* device = access->devices;
395+       device != NULL; device = device->next) {
396+    pci_fill_info(device, 33);
397+    bool is_gpu = false;
398+    switch (device->device_class) {
399+      case PCI_CLASS_DISPLAY_VGA:
400+      case PCI_CLASS_DISPLAY_XGA:
401+      case PCI_CLASS_DISPLAY_3D:
402+        is_gpu = true;
403+        break;
404+      case PCI_CLASS_DISPLAY_OTHER:
405+      default:
406+        break;
407+    }
408+    if (!is_gpu)
409+      continue;
410+    if (device->vendor_id == 0 || device->device_id == 0)
411+      continue;
412+
413+    GPUInfo::GPUDevice gpu;
414+    gpu.vendor_id = device->vendor_id;
415+    gpu.device_id = device->device_id;
416+
417+    if (!primary_gpu_identified) {
418+      primary_gpu_identified = true;
419+      gpu_info->gpu = gpu;
420+    } else {
421+      // TODO(zmo): if there are multiple GPUs, we assume the non Intel
422+      // one is primary. Revisit this logic because we actually don't know
423+      // which GPU we are using at this point.
424+      if (gpu_info->gpu.vendor_id == kVendorIDIntel &&
425+          gpu.vendor_id != kVendorIDIntel) {
426+        gpu_info->secondary_gpus.push_back(gpu_info->gpu);
427+        gpu_info->gpu = gpu;
428+      } else {
429+        gpu_info->secondary_gpus.push_back(gpu);
430+      }
431+    }
432+  }
433+
434+  // Detect Optimus or AMD Switchable GPU.
435+  if (gpu_info->secondary_gpus.size() == 1 &&
436+      gpu_info->secondary_gpus[0].vendor_id == kVendorIDIntel) {
437+    if (gpu_info->gpu.vendor_id == kVendorIDNVidia)
438+      gpu_info->optimus = true;
439+    if (gpu_info->gpu.vendor_id == kVendorIDAMD)
440+      gpu_info->amd_switchable = true;
441+  }
442+
443+  pci_cleanup(access);
444+  if (!primary_gpu_identified)
445+    return kCollectInfoNonFatalFailure;
446+  return kCollectInfoSuccess;
447+}
448+
449+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
450+  DCHECK(vendor_id && device_id);
451+  *vendor_id = 0;
452+  *device_id = 0;
453+
454+  GPUInfo gpu_info;
455+  CollectInfoResult result = CollectPCIVideoCardInfo(&gpu_info);
456+  if (result == kCollectInfoSuccess) {
457+    *vendor_id = gpu_info.gpu.vendor_id;
458+    *device_id = gpu_info.gpu.device_id;
459+  }
460+  return result;
461+}
462+
463+#endif // defined(OS_LINUX)
464+
465+#if defined(OS_MACOSX)
466+
467+CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
468+  DCHECK(vendor_id && device_id);
469+
470+  GPUInfo::GPUDevice gpu = GetActiveGPU();
471+  *vendor_id = gpu.vendor_id;
472+  *device_id = gpu.device_id;
473+
474+  if (*vendor_id != 0 && *device_id != 0)
475+    return kCollectInfoSuccess;
476+  return kCollectInfoNonFatalFailure;
477+}
478+
479 #endif
480
481+#if defined(OS_ANDROID)
482+CollectInfoResult CollectGpuID(uint32 *vendor_id, uint32 *device_id)
483+{
484+    DCHECK(vendor_id && device_id);
485+    *vendor_id = 0;
486+    *device_id = 0;
487+    return kCollectInfoNonFatalFailure;
488+}
489+#endif  // defined(OS_ANDROID)
490+
491 namespace gpu {
492
493 namespace {
494@@ -245,33 +430,41 @@ bool GPUTestBotConfig::Matches(const std
495   return Matches(config);
496 }
497
498-bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) {
499-  bool rt;
500-  if (gpu_info == NULL) {
501-    GPUInfo my_gpu_info;
502-    CollectInfoResult result = CollectGpuID(
503-        &my_gpu_info.gpu.vendor_id, &my_gpu_info.gpu.device_id);
504-    if (result != kCollectInfoSuccess) {
505-      LOG(ERROR) << "Fail to identify GPU";
506-      DisableGPUInfoValidation();
507-      rt = true;
508-    } else {
509-      rt = SetGPUInfo(my_gpu_info);
510+bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo *gpu_info)
511+{
512+    bool rt;
513+    if (gpu_info == NULL)
514+    {
515+        GPUInfo my_gpu_info;
516+        CollectInfoResult result =
517+            CollectGpuID(&my_gpu_info.gpu.vendor_id, &my_gpu_info.gpu.device_id);
518+        if (result != kCollectInfoSuccess)
519+        {
520+            LOG(ERROR) << "Fail to identify GPU\n";
521+            DisableGPUInfoValidation();
522+            rt = true;
523+        }
524+        else
525+        {
526+            rt = SetGPUInfo(my_gpu_info);
527+        }
528+    }
529+    else
530+    {
531+        rt = SetGPUInfo(*gpu_info);
532+    }
533+    set_os(GetCurrentOS());
534+    if (os() == kOsUnknown)
535+    {
536+        LOG(ERROR) << "Unknown OS\n";
537+        rt = false;
538     }
539-  } else {
540-    rt = SetGPUInfo(*gpu_info);
541-  }
542-  set_os(GetCurrentOS());
543-  if (os() == kOsUnknown) {
544-    LOG(ERROR) << "Unknown OS";
545-    rt = false;
546-  }
547 #if defined(NDEBUG)
548-  set_build_type(kBuildTypeRelease);
549+    set_build_type(kBuildTypeRelease);
550 #else
551-  set_build_type(kBuildTypeDebug);
552+    set_build_type(kBuildTypeDebug);
553 #endif
554-  return rt;
555+    return rt;
556 }
557
558 // static
559@@ -295,21 +488,5 @@ bool GPUTestBotConfig::CurrentConfigMatc
560   return false;
561 }
562
563-// static
564-bool GPUTestBotConfig::GpuBlacklistedOnBot() {
565-#if defined(OS_MACOSX)
566-  // Blacklist rule #81 disables all Gpu acceleration on Mac < 10.8 bots.
567-  if (CurrentConfigMatches("MAC VMWARE") && base::mac::IsOSLionOrEarlier()) {
568-    return true;
569-  }
570-#elif defined(OS_WIN)
571-  // Blacklist rule #79 disables all Gpu acceleration before Windows 7.
572-  if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
573-    return true;
574-  }
575-#endif
576-  return false;
577-}
578-
579 }  // namespace gpu
580
581diff -rupN gpu_test_expectations_reverted/gpu_test_config.h gpu_test_expectations/gpu_test_config.h
582--- gpu_test_expectations_reverted/gpu_test_config.h	2016-08-12 21:23:54.884132405 -0400
583+++ gpu_test_expectations/gpu_test_config.h	2015-11-30 21:54:30.239267635 -0500
584@@ -8,9 +8,7 @@
585 #include <string>
586 #include <vector>
587
588-#include "base/basictypes.h"
589-#include "base/compiler_specific.h"
590-#include "gpu/gpu_export.h"
591+#include "angle_config.h"
592
593 namespace gpu {
594
595@@ -134,9 +132,6 @@ class GPU_EXPORT GPUTestBotConfig : publ
596   // Check if this bot's config matches |config_data| or any of the |configs|.
597   static bool CurrentConfigMatches(const std::string& config_data);
598   static bool CurrentConfigMatches(const std::vector<std::string>& configs);
599-
600-  // Check if the bot has blacklisted all GPU features.
601-  static bool GpuBlacklistedOnBot();
602 };
603
604 }  // namespace gpu
605diff -rupN gpu_test_expectations_reverted/gpu_test_config_mac.h gpu_test_expectations/gpu_test_config_mac.h
606--- gpu_test_expectations_reverted/gpu_test_config_mac.h	1969-12-31 19:00:00.000000000 -0500
607+++ gpu_test_expectations/gpu_test_config_mac.h	2015-11-30 21:54:30.239267635 -0500
608@@ -0,0 +1,28 @@
609+//
610+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
611+// Use of this source code is governed by a BSD-style license that can be
612+// found in the LICENSE file.
613+//
614+// gpu_test_config_mac.h:
615+//   Helper functions for gpu_test_config that have to be compiled in ObjectiveC++
616+//
617+
618+#ifndef GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
619+#define GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
620+
621+#include "gpu_info.h"
622+
623+namespace base {
624+
625+class SysInfo
626+{
627+  public:
628+    static void OperatingSystemVersionNumbers(
629+        int32 *major_version, int32 *minor_version, int32 *bugfix_version);
630+};
631+
632+} // namespace base
633+
634+gpu::GPUInfo::GPUDevice GetActiveGPU();
635+
636+#endif // GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
637diff -rupN gpu_test_expectations_reverted/gpu_test_config_mac.mm gpu_test_expectations/gpu_test_config_mac.mm
638--- gpu_test_expectations_reverted/gpu_test_config_mac.mm	1969-12-31 19:00:00.000000000 -0500
639+++ gpu_test_expectations/gpu_test_config_mac.mm	2015-11-30 21:54:30.239267635 -0500
640@@ -0,0 +1,67 @@
641+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
642+// Use of this source code is governed by a BSD-style license that can be
643+// found in the LICENSE file.
644+
645+// gpu_test_config_mac.mm:
646+//   Helper functions for gpu_test_config that have to be compiled in ObjectiveC++
647+
648+#include "gpu_test_config_mac.h"
649+
650+#import <Cocoa/Cocoa.h>
651+
652+namespace base {
653+
654+void SysInfo::OperatingSystemVersionNumbers(
655+    int32 *major_version, int32 *minor_version, int32 *bugfix_version)
656+{
657+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
658+  Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32*>(major_version));
659+  Gestalt(gestaltSystemVersionMinor, reinterpret_cast<SInt32*>(minor_version));
660+  Gestalt(gestaltSystemVersionBugFix, reinterpret_cast<SInt32*>(bugfix_version));
661+#else
662+  NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
663+  *major_version = version.majorVersion;
664+  *minor_version = version.minorVersion;
665+  *bugfix_version = version.patchVersion;
666+#endif
667+}
668+
669+} // namespace base
670+
671+UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) {
672+  CFTypeRef type = IORegistryEntrySearchCFProperty(entry,
673+                                                   kIOServicePlane,
674+                                                   property_name,
675+                                                   kCFAllocatorDefault,
676+                                                   kIORegistryIterateRecursively | kIORegistryIterateParents);
677+  CFDataRef data = reinterpret_cast<CFDataRef>(type);
678+  if (!data) {
679+    CFRelease(data);
680+    return 0;
681+  }
682+
683+  UInt32 value = 0;
684+  const uint32_t* valuePointer = reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(data));
685+  if (valuePointer != NULL) {
686+    value = *valuePointer;
687+  }
688+  CFRelease(data);
689+  return value;
690+}
691+
692+gpu::GPUInfo::GPUDevice GetActiveGPU() {
693+  gpu::GPUInfo::GPUDevice gpu;
694+
695+  // Ignore the fact that CGDisplayIOServicePort is deprecated as Apple
696+  // did not provide a good replacement for it as of 10.10.
697+  // TODO(cwallez) revisit with later systems
698+  #pragma clang diagnostic push
699+  #pragma clang diagnostic ignored "-Wdeprecated-declarations"
700+    io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
701+  #pragma clang diagnostic pop
702+
703+  gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id"));
704+  gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id"));
705+  return gpu;
706+}
707+
708diff -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu_test_expectations/gpu_test_expectations_parser.cc
709--- gpu_test_expectations_reverted/gpu_test_expectations_parser.cc	2016-08-12 21:23:54.884132405 -0400
710+++ gpu_test_expectations/gpu_test_expectations_parser.cc	2015-11-30 21:54:30.239267635 -0500
711@@ -2,14 +2,43 @@
712 // Use of this source code is governed by a BSD-style license that can be
713 // found in the LICENSE file.
714
715-#include "gpu/config/gpu_test_expectations_parser.h"
716+#include "gpu_test_expectations_parser.h"
717
718-#include "base/files/file_util.h"
719-#include "base/logging.h"
720-#include "base/strings/string_number_conversions.h"
721-#include "base/strings/string_split.h"
722-#include "base/strings/string_util.h"
723-#include "base/strings/stringprintf.h"
724+#include "common/angleutils.h"
725+
726+namespace base {
727+
728+namespace {
729+
730+bool StartsWithASCII(const std::string& str,
731+                     const std::string& search,
732+                     bool case_sensitive) {
733+  ASSERT(!case_sensitive);
734+  return str.compare(0, search.length(), search) == 0;
735+}
736+
737+template <class Char> inline Char ToLowerASCII(Char c) {
738+  return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
739+}
740+
741+template<typename Iter>
742+static inline bool DoLowerCaseEqualsASCII(Iter a_begin,
743+                                          Iter a_end,
744+                                          const char* b) {
745+  for (Iter it = a_begin; it != a_end; ++it, ++b) {
746+    if (!*b || base::ToLowerASCII(*it) != *b)
747+      return false;
748+  }
749+  return *b == 0;
750+}
751+
752+bool LowerCaseEqualsASCII(const std::string& a, const char* b) {
753+  return DoLowerCaseEqualsASCII(a.begin(), a.end(), b);
754+}
755+
756+} // anonymous namespace
757+
758+} // namespace base
759
760 namespace gpu {
761
762@@ -146,9 +175,9 @@ const char* kErrorMessage[] = {
763 };
764
765 Token ParseToken(const std::string& word) {
766-  if (base::StartsWith(word, "//", base::CompareCase::INSENSITIVE_ASCII))
767+  if (base::StartsWithASCII(word, "//", false))
768     return kTokenComment;
769-  if (base::StartsWith(word, "0x", base::CompareCase::INSENSITIVE_ASCII))
770+  if (base::StartsWithASCII(word, "0x", false))
771     return kConfigGPUDeviceID;
772
773   for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) {
774@@ -176,10 +205,10 @@ bool NamesMatching(const std::string& re
775
776 GPUTestExpectationsParser::GPUTestExpectationsParser() {
777   // Some sanity check.
778-  DCHECK_EQ(static_cast<unsigned int>(kNumberOfExactMatchTokens),
779-            sizeof(kTokenData) / sizeof(kTokenData[0]));
780-  DCHECK_EQ(static_cast<unsigned int>(kNumberOfErrors),
781-            sizeof(kErrorMessage) / sizeof(kErrorMessage[0]));
782+  static_assert(static_cast<unsigned int>(kNumberOfExactMatchTokens) ==
783+                sizeof(kTokenData) / sizeof(kTokenData[0]), "sanity check");
784+  static_assert(static_cast<unsigned int>(kNumberOfErrors) ==
785+                sizeof(kErrorMessage) / sizeof(kErrorMessage[0]), "sanity check");
786 }
787
788 GPUTestExpectationsParser::~GPUTestExpectationsParser() {
789@@ -204,8 +233,8 @@ bool GPUTestExpectationsParser::LoadTest
790   return rt;
791 }
792
793-bool GPUTestExpectationsParser::LoadTestExpectations(
794-    const base::FilePath& path) {
795+bool GPUTestExpectationsParser::LoadTestExpectationsFromFile(
796+    const std::string& path) {
797   entries_.clear();
798   error_messages_.clear();
799
800@@ -399,7 +428,7 @@ bool GPUTestExpectationsParser::ParseLin
801           stage++;
802         break;
803       default:
804-        DCHECK(false);
805+        UNREACHABLE();
806         break;
807     }
808   }
809@@ -488,7 +517,7 @@ bool GPUTestExpectationsParser::UpdateTe
810       config->set_api(config->api() | kTokenData[token].flag);
811       break;
812     default:
813-      DCHECK(false);
814+      UNREACHABLE();
815       break;
816   }
817   return true;
818diff -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.h gpu_test_expectations/gpu_test_expectations_parser.h
819--- gpu_test_expectations_reverted/gpu_test_expectations_parser.h	2016-08-12 21:23:54.884132405 -0400
820+++ gpu_test_expectations/gpu_test_expectations_parser.h	2015-11-30 21:54:30.239267635 -0500
821@@ -8,10 +8,8 @@
822 #include <string>
823 #include <vector>
824
825-#include "base/basictypes.h"
826-#include "base/files/file_path.h"
827-#include "gpu/config/gpu_test_config.h"
828-#include "gpu/gpu_export.h"
829+#include "angle_config.h"
830+#include "gpu_test_config.h"
831
832 namespace gpu {
833
834@@ -32,7 +30,7 @@ class GPU_EXPORT GPUTestExpectationsPars
835   // save all the entries. Otherwise, generate error messages.
836   // Return true if parsing succeeds.
837   bool LoadTestExpectations(const std::string& data);
838-  bool LoadTestExpectations(const base::FilePath& path);
839+  bool LoadTestExpectationsFromFile(const std::string& path);
840
841   // Query error messages from the last LoadTestExpectations() call.
842   const std::vector<std::string>& GetErrorMessages() const;
843diff -rupN gpu_test_expectations_reverted/HowToMakeChanges.md gpu_test_expectations/HowToMakeChanges.md
844--- gpu_test_expectations_reverted/HowToMakeChanges.md	1969-12-31 19:00:00.000000000 -0500
845+++ gpu_test_expectations/HowToMakeChanges.md	2016-09-09 16:27:56.575809921 -0400
846@@ -0,0 +1,22 @@
847+Because the ```gpu_test_expectations``` directory is based on parts of Chromium's ```gpu/config```
848+directory, we want to keep a patch of the changes added to make it compile with ANGLE. This
849+will allow us to merge Chromium changes easily in our ```gpu_test_expectations```.
850+
851+In order to make a change to this directory, do the following:
852+
853+ * copy the directory somewhere like in ```gpu_test_expectations_reverted```
854+ * in ```gpu_test_expectations_reverted``` run ```patch -p 1 -R < angle-mods.patch```
855+ * do your changes in ```gpu_test_expectations```
856+ * delete angle-mods.patch in both directories
857+ * run ```diff -rupN gpu_test_expectations_reverted gpu_test_expectations > angle-mods.patch```
858+ * copy ```angle-mods.patch``` in ```gpu_test_expectations```
859+
860+How to update from Chromium:
861+
862+ * ```git apply -R angle-mods.patch```, ```git add . -u```, ```git commit```
863+ * Copy over Chromium files, ```git add . -u```, ```git commit```
864+ * ```git revert HEAD~```
865+ * ```rm angle-mods.patch```
866+ * ```git diff HEAD~ (`)ls(`) > angle-mods.patch```,```git add angle-mods.patch```, ```git commit --amend```
867+ * ```git rebase -i``` to squash the three patches into one.
868+
869