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

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 139053002: cc: Release main thread earlier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests broken by raciness Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/delegated_frame_provider.h" 9 #include "cc/layers/delegated_frame_provider.h"
10 #include "cc/layers/delegated_frame_resource_collection.h" 10 #include "cc/layers/delegated_frame_resource_collection.h"
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 } 1918 }
1919 }; 1919 };
1920 1920
1921 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction); 1921 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction);
1922 1922
1923 class LayerTreeHostContextTestSurfaceCreateCallback 1923 class LayerTreeHostContextTestSurfaceCreateCallback
1924 : public LayerTreeHostContextTest { 1924 : public LayerTreeHostContextTest {
1925 public: 1925 public:
1926 LayerTreeHostContextTestSurfaceCreateCallback() 1926 LayerTreeHostContextTestSurfaceCreateCallback()
1927 : LayerTreeHostContextTest(), 1927 : LayerTreeHostContextTest(),
1928 layer_(FakeContentLayer::Create(&client_)), 1928 layer_(FakeContentLayer::Create(&client_)) {}
1929 num_commits_(0) {}
1930 1929
1931 virtual void SetupTree() OVERRIDE { 1930 virtual void SetupTree() OVERRIDE {
1932 layer_->SetBounds(gfx::Size(10, 20)); 1931 layer_->SetBounds(gfx::Size(10, 20));
1933 layer_tree_host()->SetRootLayer(layer_); 1932 layer_tree_host()->SetRootLayer(layer_);
1934 LayerTreeHostContextTest::SetupTree(); 1933 LayerTreeHostContextTest::SetupTree();
1935 } 1934 }
1936 1935
1937 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 1936 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
1938 1937
1939 virtual void DidCommit() OVERRIDE { 1938 virtual void DidCommit() OVERRIDE {
1940 switch (num_commits_) { 1939 switch (layer_tree_host()->source_frame_number()) {
1941 case 0:
1942 EXPECT_EQ(1u, layer_->output_surface_created_count());
1943 layer_tree_host()->SetNeedsCommit();
1944 break;
1945 case 1: 1940 case 1:
1946 EXPECT_EQ(1u, layer_->output_surface_created_count()); 1941 EXPECT_EQ(1u, layer_->output_surface_created_count());
1947 layer_tree_host()->SetNeedsCommit(); 1942 layer_tree_host()->SetNeedsCommit();
1948 break; 1943 break;
1949 case 2: 1944 case 2:
1950 EXPECT_EQ(1u, layer_->output_surface_created_count()); 1945 EXPECT_EQ(1u, layer_->output_surface_created_count());
1946 layer_tree_host()->SetNeedsCommit();
1951 break; 1947 break;
1952 case 3: 1948 case 3:
1949 EXPECT_EQ(1u, layer_->output_surface_created_count());
1950 break;
1951 case 4:
1953 EXPECT_EQ(2u, layer_->output_surface_created_count()); 1952 EXPECT_EQ(2u, layer_->output_surface_created_count());
1954 layer_tree_host()->SetNeedsCommit(); 1953 layer_tree_host()->SetNeedsCommit();
1955 break; 1954 break;
1956 } 1955 }
1957 ++num_commits_;
1958 } 1956 }
1959 1957
1960 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1958 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1961 LayerTreeHostContextTest::CommitCompleteOnThread(impl); 1959 LayerTreeHostContextTest::CommitCompleteOnThread(impl);
1962 switch (num_commits_) { 1960 switch (LastCommittedSourceFrameNumber(impl)) {
1963 case 0: 1961 case 0:
1964 break; 1962 break;
1965 case 1: 1963 case 1:
1966 break; 1964 break;
1967 case 2: 1965 case 2:
1968 LoseContext(); 1966 LoseContext();
1969 break; 1967 break;
1970 case 3: 1968 case 3:
1971 EndTest(); 1969 EndTest();
1972 break; 1970 break;
1973 } 1971 }
1974 } 1972 }
1975 1973
1976 virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE { 1974 virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {
1977 EXPECT_TRUE(succeeded); 1975 EXPECT_TRUE(succeeded);
1978 } 1976 }
1979 1977
1980 virtual void AfterTest() OVERRIDE {} 1978 virtual void AfterTest() OVERRIDE {}
1981 1979
1982 protected: 1980 protected:
1983 FakeContentLayerClient client_; 1981 FakeContentLayerClient client_;
1984 scoped_refptr<FakeContentLayer> layer_; 1982 scoped_refptr<FakeContentLayer> layer_;
1985 int num_commits_;
1986 }; 1983 };
1987 1984
1988 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); 1985 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback);
1989 1986
1990 } // namespace 1987 } // namespace
1991 } // namespace cc 1988 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698