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

Side by Side Diff: cc/output/shader_unittest.cc

Issue 2161323002: cc: Make LayerTreeHostImpl unittests use a delegating output surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-lthi-tests: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/renderer_unittest.cc ('k') | cc/output/software_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/shader.h" 5 #include "cc/output/shader.h"
6 6
7 #include "cc/test/test_gles2_interface.h" 7 #include "cc/test/test_gles2_interface.h"
8 #include "cc/test/test_web_graphics_context_3d.h" 8 #include "cc/test/test_web_graphics_context_3d.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 TEST(ShaderTest, HighpThresholds) { 15 TEST(ShaderTest, HighpThresholds) {
16 // The test context always uses a mediump precision of 10 bits which 16 // The test context always uses a mediump precision of 10 bits which
17 // corresponds to a native highp threshold of 2^10 = 1024 17 // corresponds to a native highp threshold of 2^10 = 1024
18 std::unique_ptr<TestWebGraphicsContext3D> stub_context = 18 std::unique_ptr<TestWebGraphicsContext3D> test_context =
19 TestWebGraphicsContext3D::Create(); 19 TestWebGraphicsContext3D::Create();
20 TestGLES2Interface stub_gl(stub_context.get()); 20 TestGLES2Interface test_gl;
21 test_gl.set_test_context(test_context.get());
21 22
22 int threshold_cache = 0; 23 int threshold_cache = 0;
23 int threshold_min; 24 int threshold_min;
24 gfx::Point closePoint(512, 512); 25 gfx::Point closePoint(512, 512);
25 gfx::Size smallSize(512, 512); 26 gfx::Size smallSize(512, 512);
26 gfx::Point farPoint(2560, 2560); 27 gfx::Point farPoint(2560, 2560);
27 gfx::Size bigSize(2560, 2560); 28 gfx::Size bigSize(2560, 2560);
28 29
29 threshold_min = 0; 30 threshold_min = 0;
30 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 31 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
31 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 32 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
32 closePoint)); 33 closePoint));
33 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 34 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
34 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 35 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
35 smallSize)); 36 smallSize));
36 EXPECT_EQ(TEX_COORD_PRECISION_HIGH, 37 EXPECT_EQ(TEX_COORD_PRECISION_HIGH,
37 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 38 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
38 farPoint)); 39 farPoint));
39 EXPECT_EQ(TEX_COORD_PRECISION_HIGH, 40 EXPECT_EQ(TEX_COORD_PRECISION_HIGH,
40 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 41 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
41 bigSize)); 42 bigSize));
42 43
43 threshold_min = 3000; 44 threshold_min = 3000;
44 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 45 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
45 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 46 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
46 closePoint)); 47 closePoint));
47 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 48 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
48 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 49 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
49 smallSize)); 50 smallSize));
50 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 51 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
51 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 52 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
52 farPoint)); 53 farPoint));
53 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM, 54 EXPECT_EQ(TEX_COORD_PRECISION_MEDIUM,
54 TexCoordPrecisionRequired(&stub_gl, &threshold_cache, threshold_min, 55 TexCoordPrecisionRequired(&test_gl, &threshold_cache, threshold_min,
55 bigSize)); 56 bigSize));
56 } 57 }
57 58
58 } // namespace cc 59 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_unittest.cc ('k') | cc/output/software_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698