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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month 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 | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(json)); 700 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(json));
701 EXPECT_TRUE(debug_info_value); 701 EXPECT_TRUE(debug_info_value);
702 EXPECT_TRUE(debug_info_value->IsType(base::Value::TYPE_DICTIONARY)); 702 EXPECT_TRUE(debug_info_value->IsType(base::Value::TYPE_DICTIONARY));
703 base::DictionaryValue* dictionary = 0; 703 base::DictionaryValue* dictionary = 0;
704 EXPECT_TRUE(debug_info_value->GetAsDictionary(&dictionary)); 704 EXPECT_TRUE(debug_info_value->GetAsDictionary(&dictionary));
705 std::string roundtrip; 705 std::string roundtrip;
706 EXPECT_TRUE(dictionary->GetString("layer_name", &roundtrip)); 706 EXPECT_TRUE(dictionary->GetString("layer_name", &roundtrip));
707 EXPECT_EQ(name, roundtrip); 707 EXPECT_EQ(name, roundtrip);
708 } 708 }
709 709
710 void ReturnMailbox(bool* run, uint32 sync_point, bool is_lost) { 710 void ReturnMailbox(bool* run, const gpu::SyncToken& sync_token, bool is_lost) {
711 *run = true; 711 *run = true;
712 } 712 }
713 713
714 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { 714 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
715 scoped_ptr<Layer> l1(CreateLayer(LAYER_SOLID_COLOR)); 715 scoped_ptr<Layer> l1(CreateLayer(LAYER_SOLID_COLOR));
716 l1->SetFillsBoundsOpaquely(true); 716 l1->SetFillsBoundsOpaquely(true);
717 l1->SetForceRenderSurface(true); 717 l1->SetForceRenderSurface(true);
718 l1->SetVisible(false); 718 l1->SetVisible(false);
719 l1->SetBounds(gfx::Rect(4, 5)); 719 l1->SetBounds(gfx::Rect(4, 5));
720 720
721 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); 721 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin());
722 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); 722 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent());
723 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); 723 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque());
724 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); 724 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface());
725 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); 725 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree());
726 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); 726 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds());
727 727
728 cc::Layer* before_layer = l1->cc_layer_for_testing(); 728 cc::Layer* before_layer = l1->cc_layer_for_testing();
729 729
730 bool callback1_run = false; 730 bool callback1_run = false;
731 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0); 731 cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0);
732 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( 732 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(
733 base::Bind(ReturnMailbox, &callback1_run)), 733 base::Bind(ReturnMailbox, &callback1_run)),
734 gfx::Size(10, 10)); 734 gfx::Size(10, 10));
735 735
736 EXPECT_NE(before_layer, l1->cc_layer_for_testing()); 736 EXPECT_NE(before_layer, l1->cc_layer_for_testing());
737 737
738 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); 738 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin());
739 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); 739 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent());
740 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); 740 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque());
741 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); 741 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface());
742 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); 742 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree());
743 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); 743 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds());
744 EXPECT_FALSE(callback1_run); 744 EXPECT_FALSE(callback1_run);
745 745
746 bool callback2_run = false; 746 bool callback2_run = false;
747 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0); 747 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0);
748 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( 748 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(
749 base::Bind(ReturnMailbox, &callback2_run)), 749 base::Bind(ReturnMailbox, &callback2_run)),
750 gfx::Size(10, 10)); 750 gfx::Size(10, 10));
751 EXPECT_TRUE(callback1_run); 751 EXPECT_TRUE(callback1_run);
752 EXPECT_FALSE(callback2_run); 752 EXPECT_FALSE(callback2_run);
753 753
754 // Show solid color instead. 754 // Show solid color instead.
755 l1->SetShowSolidColorContent(); 755 l1->SetShowSolidColorContent();
756 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); 756 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin());
757 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); 757 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent());
758 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); 758 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque());
759 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); 759 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface());
760 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); 760 EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree());
761 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); 761 EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds());
762 EXPECT_TRUE(callback2_run); 762 EXPECT_TRUE(callback2_run);
763 763
764 before_layer = l1->cc_layer_for_testing(); 764 before_layer = l1->cc_layer_for_testing();
765 765
766 // Back to a texture, without changing the bounds of the layer or the texture. 766 // Back to a texture, without changing the bounds of the layer or the texture.
767 bool callback3_run = false; 767 bool callback3_run = false;
768 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0); 768 mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0);
769 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create( 769 l1->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(
770 base::Bind(ReturnMailbox, &callback3_run)), 770 base::Bind(ReturnMailbox, &callback3_run)),
771 gfx::Size(10, 10)); 771 gfx::Size(10, 10));
772 772
773 EXPECT_NE(before_layer, l1->cc_layer_for_testing()); 773 EXPECT_NE(before_layer, l1->cc_layer_for_testing());
774 774
775 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); 775 EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin());
776 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); 776 EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent());
777 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); 777 EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque());
778 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); 778 EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface());
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 root->SetOpacity(0.5f); 1873 root->SetOpacity(0.5f);
1874 WaitForSwap(); 1874 WaitForSwap();
1875 EXPECT_EQ(1u, animation_observer.animation_step_count()); 1875 EXPECT_EQ(1u, animation_observer.animation_step_count());
1876 1876
1877 EXPECT_FALSE(animation_observer.shutdown()); 1877 EXPECT_FALSE(animation_observer.shutdown());
1878 ResetCompositor(); 1878 ResetCompositor();
1879 EXPECT_TRUE(animation_observer.shutdown()); 1879 EXPECT_TRUE(animation_observer.shutdown());
1880 } 1880 }
1881 1881
1882 } // namespace ui 1882 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698