layer_tree_pixel_test.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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 3// found in the LICENSE file. 4 5#include "base/files/file_path.h" 6#include "cc/layers/solid_color_layer.h" 7#include "cc/test/layer_tree_test.h" 8 9#ifndef CC_TEST_LAYER_TREE_PIXEL_TEST_H_ 10#define CC_TEST_LAYER_TREE_PIXEL_TEST_H_ 11 12namespace cc { 13class LayerTreeHost; 14 15class LayerTreePixelTest : public LayerTreeTest { 16 protected: 17 LayerTreePixelTest(); 18 virtual ~LayerTreePixelTest(); 19 20 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE; 21 virtual scoped_refptr<cc::ContextProvider> 22 OffscreenContextProviderForMainThread() OVERRIDE; 23 virtual scoped_refptr<cc::ContextProvider> 24 OffscreenContextProviderForCompositorThread() OVERRIDE; 25 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, 26 bool result) OVERRIDE; 27 28 virtual void BeginTest() OVERRIDE; 29 virtual void SetupTree() OVERRIDE; 30 virtual void AfterTest() OVERRIDE; 31 32 scoped_refptr<SolidColorLayer> CreateSolidColorLayer(gfx::Rect rect, 33 SkColor color); 34 35 void RunPixelTest(scoped_refptr<Layer> content_root, 36 base::FilePath file_name); 37 38 // Common CSS colors defined for tests to use. 39 enum Colors { 40 kCSSOrange = 0xffffa500, 41 kCSSBrown = 0xffa52a2a, 42 kCSSGreen = 0xff008000, 43 }; 44 45 private: 46 scoped_refptr<Layer> content_root_; 47 base::FilePath ref_file_; 48}; 49 50} // namespace cc 51 52#endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_ 53