- add sources.
[platform/framework/web/crosswalk.git] / src / gpu / config / gpu_control_list_entry_unittest.cc
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/json/json_reader.h"
6 #include "gpu/config/gpu_control_list.h"
7 #include "gpu/config/gpu_info.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 #define LONG_STRING_CONST(...) #__VA_ARGS__
11
12 namespace gpu {
13
14 enum TestFeatureType {
15   TEST_FEATURE_0 = 0,
16   TEST_FEATURE_1,
17   TEST_FEATURE_2
18 };
19
20 class GpuControlListEntryTest : public testing::Test {
21  public:
22   GpuControlListEntryTest() { }
23   virtual ~GpuControlListEntryTest() { }
24
25   const GPUInfo& gpu_info() const {
26     return gpu_info_;
27   }
28
29   typedef GpuControlList::ScopedGpuControlListEntry ScopedEntry;
30
31   static ScopedEntry GetEntryFromString(
32       const std::string& json, bool supports_feature_type_all) {
33     scoped_ptr<base::Value> root;
34     root.reset(base::JSONReader::Read(json));
35     DictionaryValue* value = NULL;
36     if (root.get() == NULL || !root->GetAsDictionary(&value))
37       return NULL;
38
39     GpuControlList::FeatureMap feature_map;
40     feature_map["test_feature_0"] = TEST_FEATURE_0;
41     feature_map["test_feature_1"] = TEST_FEATURE_1;
42     feature_map["test_feature_2"] = TEST_FEATURE_2;
43
44     return GpuControlList::GpuControlListEntry::GetEntryFromValue(
45         value, true, feature_map, supports_feature_type_all);
46   }
47
48   static ScopedEntry GetEntryFromString(const std::string& json) {
49     return GetEntryFromString(json, false);
50   }
51
52   virtual void SetUp() {
53     gpu_info_.gpu.vendor_id = 0x10de;
54     gpu_info_.gpu.device_id = 0x0640;
55     gpu_info_.driver_vendor = "NVIDIA";
56     gpu_info_.driver_version = "1.6.18";
57     gpu_info_.driver_date = "7-14-2009";
58     gpu_info_.machine_model = "MacBookPro 7.1";
59     gpu_info_.gl_vendor = "NVIDIA Corporation";
60     gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
61     gpu_info_.performance_stats.graphics = 5.0;
62     gpu_info_.performance_stats.gaming = 5.0;
63     gpu_info_.performance_stats.overall = 5.0;
64   }
65
66  private:
67   GPUInfo gpu_info_;
68 };
69
70 TEST_F(GpuControlListEntryTest, DetailedEntry) {
71   const std::string json = LONG_STRING_CONST(
72       {
73         "id": 5,
74         "description": "test entry",
75         "cr_bugs": [1024, 678],
76         "webkit_bugs": [1950],
77         "os": {
78           "type": "macosx",
79           "version": {
80             "op": "=",
81             "value": "10.6.4"
82           }
83         },
84         "vendor_id": "0x10de",
85         "device_id": ["0x0640"],
86         "driver_version": {
87           "op": "=",
88           "value": "1.6.18"
89         },
90         "features": [
91           "test_feature_0"
92         ]
93       }
94   );
95
96   ScopedEntry entry(GetEntryFromString(json));
97   EXPECT_TRUE(entry.get() != NULL);
98   EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType());
99   EXPECT_FALSE(entry->disabled());
100   EXPECT_EQ(5u, entry->id());
101   EXPECT_STREQ("test entry", entry->description().c_str());
102   EXPECT_EQ(2u, entry->cr_bugs().size());
103   EXPECT_EQ(1024, entry->cr_bugs()[0]);
104   EXPECT_EQ(678, entry->cr_bugs()[1]);
105   EXPECT_EQ(1u, entry->webkit_bugs().size());
106   EXPECT_EQ(1950, entry->webkit_bugs()[0]);
107   EXPECT_EQ(1u, entry->features().size());
108   EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0));
109   EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info()));
110   EXPECT_TRUE(entry->Contains(
111       GpuControlList::kOsMacosx, "10.6.4", gpu_info()));
112 }
113
114 TEST_F(GpuControlListEntryTest, VendorOnAllOsEntry) {
115   const std::string json = LONG_STRING_CONST(
116       {
117         "id": 1,
118         "vendor_id": "0x10de",
119         "features": [
120           "test_feature_0"
121         ]
122       }
123   );
124   ScopedEntry entry(GetEntryFromString(json));
125   EXPECT_TRUE(entry.get() != NULL);
126   EXPECT_EQ(GpuControlList::kOsAny, entry->GetOsType());
127
128   const GpuControlList::OsType os_type[] = {
129     GpuControlList::kOsMacosx,
130     GpuControlList::kOsWin,
131     GpuControlList::kOsLinux,
132     GpuControlList::kOsChromeOS,
133     GpuControlList::kOsAndroid
134   };
135   for (size_t i = 0; i < arraysize(os_type); ++i)
136     EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
137 }
138
139 TEST_F(GpuControlListEntryTest, VendorOnLinuxEntry) {
140   const std::string json = LONG_STRING_CONST(
141       {
142         "id": 1,
143         "os": {
144           "type": "linux"
145         },
146         "vendor_id": "0x10de",
147         "features": [
148           "test_feature_0"
149         ]
150       }
151   );
152   ScopedEntry entry(GetEntryFromString(json));
153   EXPECT_TRUE(entry.get() != NULL);
154   EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType());
155
156   const GpuControlList::OsType os_type[] = {
157     GpuControlList::kOsMacosx,
158     GpuControlList::kOsWin,
159     GpuControlList::kOsChromeOS,
160     GpuControlList::kOsAndroid
161   };
162   for (size_t i = 0; i < arraysize(os_type); ++i)
163     EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info()));
164   EXPECT_TRUE(entry->Contains(
165       GpuControlList::kOsLinux, "10.6", gpu_info()));
166 }
167
168 TEST_F(GpuControlListEntryTest, AllExceptNVidiaOnLinuxEntry) {
169   const std::string json = LONG_STRING_CONST(
170       {
171         "id": 1,
172         "os": {
173           "type": "linux"
174         },
175         "exceptions": [
176           {
177             "vendor_id": "0x10de"
178           }
179         ],
180         "features": [
181           "test_feature_0"
182         ]
183       }
184   );
185   ScopedEntry entry(GetEntryFromString(json));
186   EXPECT_TRUE(entry.get() != NULL);
187   EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType());
188
189   const GpuControlList::OsType os_type[] = {
190     GpuControlList::kOsMacosx,
191     GpuControlList::kOsWin,
192     GpuControlList::kOsLinux,
193     GpuControlList::kOsChromeOS,
194     GpuControlList::kOsAndroid
195   };
196   for (size_t i = 0; i < arraysize(os_type); ++i)
197     EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info()));
198 }
199
200 TEST_F(GpuControlListEntryTest, AllExceptIntelOnLinuxEntry) {
201   const std::string json = LONG_STRING_CONST(
202       {
203         "id": 1,
204         "os": {
205           "type": "linux"
206         },
207         "exceptions": [
208           {
209             "vendor_id": "0x8086"
210           }
211         ],
212         "features": [
213           "test_feature_0"
214         ]
215       }
216   );
217   ScopedEntry entry(GetEntryFromString(json));
218   EXPECT_TRUE(entry.get() != NULL);
219   EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType());
220
221   const GpuControlList::OsType os_type[] = {
222     GpuControlList::kOsMacosx,
223     GpuControlList::kOsWin,
224     GpuControlList::kOsChromeOS,
225     GpuControlList::kOsAndroid
226   };
227   for (size_t i = 0; i < arraysize(os_type); ++i)
228     EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info()));
229   EXPECT_TRUE(entry->Contains(
230       GpuControlList::kOsLinux, "10.6", gpu_info()));
231 }
232
233 TEST_F(GpuControlListEntryTest, DateOnWindowsEntry) {
234   const std::string json = LONG_STRING_CONST(
235       {
236         "id": 1,
237         "os": {
238           "type": "win"
239         },
240         "driver_date": {
241           "op": "<",
242           "value": "2010.5.8"
243         },
244         "features": [
245           "test_feature_0"
246         ]
247       }
248   );
249   ScopedEntry entry(GetEntryFromString(json));
250   EXPECT_TRUE(entry.get() != NULL);
251   EXPECT_EQ(GpuControlList::kOsWin, entry->GetOsType());
252
253   GPUInfo gpu_info;
254   gpu_info.driver_date = "4-12-2010";
255   EXPECT_TRUE(entry->Contains(
256       GpuControlList::kOsWin, "10.6", gpu_info));
257   gpu_info.driver_date = "5-8-2010";
258   EXPECT_FALSE(entry->Contains(
259       GpuControlList::kOsWin, "10.6", gpu_info));
260   gpu_info.driver_date = "5-9-2010";
261   EXPECT_FALSE(entry->Contains(
262       GpuControlList::kOsWin, "10.6", gpu_info));
263 }
264
265 TEST_F(GpuControlListEntryTest, MultipleDevicesEntry) {
266   const std::string json = LONG_STRING_CONST(
267       {
268         "id": 1,
269         "vendor_id": "0x10de",
270         "device_id": ["0x1023", "0x0640"],
271         "features": [
272           "test_feature_0"
273         ]
274       }
275   );
276   ScopedEntry entry(GetEntryFromString(json));
277   EXPECT_TRUE(entry.get() != NULL);
278   EXPECT_EQ(GpuControlList::kOsAny, entry->GetOsType());
279
280   const GpuControlList::OsType os_type[] = {
281     GpuControlList::kOsMacosx,
282     GpuControlList::kOsWin,
283     GpuControlList::kOsLinux,
284     GpuControlList::kOsChromeOS,
285     GpuControlList::kOsAndroid
286   };
287   for (size_t i = 0; i < arraysize(os_type); ++i)
288     EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
289 }
290
291 TEST_F(GpuControlListEntryTest, ChromeOSEntry) {
292   const std::string json = LONG_STRING_CONST(
293       {
294         "id": 1,
295         "os": {
296           "type": "chromeos"
297         },
298         "features": [
299           "test_feature_0"
300         ]
301       }
302   );
303   ScopedEntry entry(GetEntryFromString(json));
304   EXPECT_TRUE(entry.get() != NULL);
305   EXPECT_EQ(GpuControlList::kOsChromeOS, entry->GetOsType());
306
307   const GpuControlList::OsType os_type[] = {
308     GpuControlList::kOsMacosx,
309     GpuControlList::kOsWin,
310     GpuControlList::kOsLinux,
311     GpuControlList::kOsAndroid
312   };
313   for (size_t i = 0; i < arraysize(os_type); ++i)
314     EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info()));
315   EXPECT_TRUE(entry->Contains(
316       GpuControlList::kOsChromeOS, "10.6", gpu_info()));
317 }
318
319 TEST_F(GpuControlListEntryTest, MalformedVendor) {
320   const std::string json = LONG_STRING_CONST(
321       {
322         "id": 1,
323         "vendor_id": "[0x10de]",
324         "features": [
325           "test_feature_0"
326         ]
327       }
328   );
329   ScopedEntry entry(GetEntryFromString(json));
330   EXPECT_TRUE(entry.get() == NULL);
331 }
332
333 TEST_F(GpuControlListEntryTest, UnknownFieldEntry) {
334   const std::string json = LONG_STRING_CONST(
335       {
336         "id": 1,
337         "unknown_field": 0,
338         "features": [
339           "test_feature_0"
340         ]
341       }
342   );
343   ScopedEntry entry(GetEntryFromString(json));
344   EXPECT_TRUE(entry.get() == NULL);
345 }
346
347 TEST_F(GpuControlListEntryTest, UnknownExceptionFieldEntry) {
348   const std::string json = LONG_STRING_CONST(
349       {
350         "id": 2,
351         "exceptions": [
352           {
353             "unknown_field": 0
354           }
355         ],
356         "features": [
357           "test_feature_0"
358         ]
359       }
360   );
361   ScopedEntry entry(GetEntryFromString(json));
362   EXPECT_TRUE(entry.get() == NULL);
363 }
364
365 TEST_F(GpuControlListEntryTest, UnknownFeatureEntry) {
366   const std::string json = LONG_STRING_CONST(
367       {
368         "id": 1,
369         "features": [
370           "some_unknown_feature",
371           "test_feature_0"
372         ]
373       }
374   );
375   ScopedEntry entry(GetEntryFromString(json));
376   EXPECT_TRUE(entry.get() == NULL);
377 }
378
379 TEST_F(GpuControlListEntryTest, GlVendorEntry) {
380   const std::string json = LONG_STRING_CONST(
381       {
382         "id": 1,
383         "gl_vendor": {
384           "op": "beginwith",
385           "value": "NVIDIA"
386         },
387         "features": [
388           "test_feature_0"
389         ]
390       }
391   );
392   ScopedEntry entry(GetEntryFromString(json));
393   EXPECT_TRUE(entry.get() != NULL);
394
395   const GpuControlList::OsType os_type[] = {
396     GpuControlList::kOsMacosx,
397     GpuControlList::kOsWin,
398     GpuControlList::kOsLinux,
399     GpuControlList::kOsChromeOS,
400     GpuControlList::kOsAndroid
401   };
402   for (size_t i = 0; i < arraysize(os_type); ++i)
403     EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
404 }
405
406 TEST_F(GpuControlListEntryTest, GlRendererEntry) {
407   const std::string json = LONG_STRING_CONST(
408       {
409         "id": 1,
410         "gl_renderer": {
411           "op": "contains",
412           "value": "GeForce"
413         },
414         "features": [
415           "test_feature_0"
416         ]
417       }
418   );
419   ScopedEntry entry(GetEntryFromString(json));
420   EXPECT_TRUE(entry.get() != NULL);
421
422   const GpuControlList::OsType os_type[] = {
423     GpuControlList::kOsMacosx,
424     GpuControlList::kOsWin,
425     GpuControlList::kOsLinux,
426     GpuControlList::kOsChromeOS,
427     GpuControlList::kOsAndroid
428   };
429   for (size_t i = 0; i < arraysize(os_type); ++i)
430     EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
431 }
432
433 TEST_F(GpuControlListEntryTest, PerfGraphicsEntry) {
434   const std::string json = LONG_STRING_CONST(
435       {
436         "id": 1,
437         "perf_graphics": {
438           "op": "<",
439           "value": "6.0"
440         },
441         "features": [
442           "test_feature_0"
443         ]
444       }
445   );
446   ScopedEntry entry(GetEntryFromString(json));
447   EXPECT_TRUE(entry.get() != NULL);
448   EXPECT_TRUE(entry->Contains(GpuControlList::kOsWin, "10.6", gpu_info()));
449 }
450
451 TEST_F(GpuControlListEntryTest, PerfGamingEntry) {
452   const std::string json = LONG_STRING_CONST(
453       {
454         "id": 1,
455         "perf_graphics": {
456           "op": "<=",
457           "value": "4.0"
458         },
459         "features": [
460           "test_feature_0"
461         ]
462       }
463   );
464   ScopedEntry entry(GetEntryFromString(json));
465   EXPECT_TRUE(entry.get() != NULL);
466   EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "10.6", gpu_info()));
467 }
468
469 TEST_F(GpuControlListEntryTest, PerfOverallEntry) {
470   const std::string json = LONG_STRING_CONST(
471       {
472         "id": 1,
473         "perf_overall": {
474           "op": "between",
475           "value": "1.0",
476           "value2": "9.0"
477         },
478         "features": [
479           "test_feature_0"
480         ]
481       }
482   );
483   ScopedEntry entry(GetEntryFromString(json));
484   EXPECT_TRUE(entry.get() != NULL);
485   EXPECT_TRUE(entry->Contains(GpuControlList::kOsWin, "10.6", gpu_info()));
486 }
487
488 TEST_F(GpuControlListEntryTest, DisabledEntry) {
489   const std::string json = LONG_STRING_CONST(
490       {
491         "id": 1,
492         "disabled": true,
493         "features": [
494           "test_feature_0"
495         ]
496       }
497   );
498   ScopedEntry entry(GetEntryFromString(json));
499   EXPECT_TRUE(entry.get() != NULL);
500   EXPECT_TRUE(entry->disabled());
501 }
502
503 TEST_F(GpuControlListEntryTest, OptimusEntry) {
504   const std::string json = LONG_STRING_CONST(
505       {
506         "id": 1,
507         "os": {
508           "type": "linux"
509         },
510         "multi_gpu_style": "optimus",
511         "features": [
512           "test_feature_0"
513         ]
514       }
515   );
516   GPUInfo gpu_info;
517   gpu_info.optimus = true;
518
519   ScopedEntry entry(GetEntryFromString(json));
520   EXPECT_TRUE(entry.get() != NULL);
521   EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType());
522   EXPECT_TRUE(entry->Contains(
523       GpuControlList::kOsLinux, "10.6", gpu_info));
524 }
525
526 TEST_F(GpuControlListEntryTest, AMDSwitchableEntry) {
527   const std::string json = LONG_STRING_CONST(
528       {
529         "id": 1,
530         "os": {
531           "type": "macosx"
532         },
533         "multi_gpu_style": "amd_switchable",
534         "features": [
535           "test_feature_0"
536         ]
537       }
538   );
539   GPUInfo gpu_info;
540   gpu_info.amd_switchable = true;
541
542   ScopedEntry entry(GetEntryFromString(json));
543   EXPECT_TRUE(entry.get() != NULL);
544   EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType());
545   EXPECT_TRUE(entry->Contains(
546       GpuControlList::kOsMacosx, "10.6", gpu_info));
547 }
548
549 TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) {
550   const std::string json = LONG_STRING_CONST(
551       {
552         "id": 1,
553         "os": {
554           "type": "linux"
555         },
556         "vendor_id": "0x1002",
557         "driver_version": {
558           "op": "=",
559           "style": "lexical",
560           "value": "8.76"
561         },
562         "features": [
563           "test_feature_0"
564         ]
565       }
566   );
567   GPUInfo gpu_info;
568   gpu_info.gpu.vendor_id = 0x1002;
569
570   ScopedEntry entry(GetEntryFromString(json));
571   EXPECT_TRUE(entry.get() != NULL);
572   EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType());
573
574   gpu_info.driver_version = "8.76";
575   EXPECT_TRUE(entry->Contains(
576       GpuControlList::kOsLinux, "10.6", gpu_info));
577
578   gpu_info.driver_version = "8.768";
579   EXPECT_TRUE(entry->Contains(
580       GpuControlList::kOsLinux, "10.6", gpu_info));
581
582   gpu_info.driver_version = "8.76.8";
583   EXPECT_TRUE(entry->Contains(
584       GpuControlList::kOsLinux, "10.6", gpu_info));
585 }
586
587 TEST_F(GpuControlListEntryTest, MultipleGPUsAnyEntry) {
588   const std::string json = LONG_STRING_CONST(
589       {
590         "id": 1,
591         "os": {
592           "type": "macosx"
593         },
594         "vendor_id": "0x8086",
595         "device_id": ["0x0166"],
596         "multi_gpu_category": "any",
597         "features": [
598           "test_feature_0"
599         ]
600       }
601   );
602   ScopedEntry entry(GetEntryFromString(json));
603   EXPECT_TRUE(entry.get() != NULL);
604   EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType());
605
606   GPUInfo gpu_info;
607   gpu_info.gpu.vendor_id = 0x10de;
608   gpu_info.gpu.device_id = 0x1976;
609   EXPECT_FALSE(entry->Contains(
610       GpuControlList::kOsMacosx, "10.6", gpu_info));
611
612   GPUInfo::GPUDevice gpu_device;
613   gpu_device.vendor_id = 0x8086;
614   gpu_device.device_id = 0x0166;
615   gpu_info.secondary_gpus.push_back(gpu_device);
616   EXPECT_TRUE(entry->Contains(
617       GpuControlList::kOsMacosx, "10.6", gpu_info));
618 }
619
620 TEST_F(GpuControlListEntryTest, MultipleGPUsSecondaryEntry) {
621   const std::string json = LONG_STRING_CONST(
622       {
623         "id": 1,
624         "os": {
625           "type": "macosx"
626         },
627         "vendor_id": "0x8086",
628         "device_id": ["0x0166"],
629         "multi_gpu_category": "secondary",
630         "features": [
631           "test_feature_0"
632         ]
633       }
634   );
635   ScopedEntry entry(GetEntryFromString(json));
636   EXPECT_TRUE(entry.get() != NULL);
637   EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType());
638
639   GPUInfo gpu_info;
640   gpu_info.gpu.vendor_id = 0x10de;
641   gpu_info.gpu.device_id = 0x1976;
642   EXPECT_FALSE(entry->Contains(
643       GpuControlList::kOsMacosx, "10.6", gpu_info));
644
645   GPUInfo::GPUDevice gpu_device;
646   gpu_device.vendor_id = 0x8086;
647   gpu_device.device_id = 0x0166;
648   gpu_info.secondary_gpus.push_back(gpu_device);
649   EXPECT_TRUE(entry->Contains(
650       GpuControlList::kOsMacosx, "10.6", gpu_info));
651 }
652
653 TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) {
654   const std::string json = LONG_STRING_CONST(
655       {
656         "id": 1,
657         "vendor_id": "0x8086",
658         "driver_version": {
659           "op": "<",
660           "value": "10.7"
661         },
662         "features": [
663           "test_feature_1"
664         ]
665       }
666   );
667   ScopedEntry entry(GetEntryFromString(json));
668   EXPECT_TRUE(entry.get() != NULL);
669
670   GPUInfo gpu_info;
671   gpu_info.gpu.vendor_id = 0x8086;
672   EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info));
673
674   gpu_info.driver_version = "10.6";
675   EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info));
676 }
677
678 TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) {
679   const std::string json = LONG_STRING_CONST(
680       {
681         "id": 1,
682         "vendor_id": "0x8086",
683         "exceptions": [
684           {
685             "gl_renderer": {
686               "op": "contains",
687               "value": "mesa"
688             }
689           }
690         ],
691         "features": [
692           "test_feature_1"
693         ]
694       }
695   );
696   ScopedEntry entry(GetEntryFromString(json));
697   EXPECT_TRUE(entry.get() != NULL);
698
699   GPUInfo gpu_info;
700   gpu_info.gpu.vendor_id = 0x8086;
701   EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info));
702
703   gpu_info.gl_renderer = "mesa";
704   EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info));
705 }
706
707 TEST_F(GpuControlListEntryTest, FeatureTypeAllEntry) {
708   const std::string json = LONG_STRING_CONST(
709       {
710         "id": 1,
711         "features": [
712           "all"
713         ]
714       }
715   );
716   ScopedEntry entry(GetEntryFromString(json, true));
717   EXPECT_TRUE(entry.get() != NULL);
718   EXPECT_EQ(3u, entry->features().size());
719   EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0));
720   EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_1));
721   EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_2));
722 }
723
724 }  // namespace gpu
725