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

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

Issue 10454107: Revert 139494 - ash: Improved window maximize/restore animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « ui/compositor/layer_animation_observer.h ('k') | ui/gfx/transform.h » ('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 (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/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { 303 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
304 } 304 }
305 305
306 DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate); 306 DISALLOW_COPY_AND_ASSIGN(NullLayerDelegate);
307 }; 307 };
308 308
309 // Remembers if it has been notified. 309 // Remembers if it has been notified.
310 class TestCompositorObserver : public CompositorObserver { 310 class TestCompositorObserver : public CompositorObserver {
311 public: 311 public:
312 TestCompositorObserver() : started_(false), ended_(false), aborted_(false) {} 312 TestCompositorObserver() : started_(false), ended_(false) {}
313 313
314 bool notified() const { return started_ && ended_; } 314 bool notified() const { return started_ && ended_; }
315 bool aborted() const { return aborted_; }
316 315
317 void Reset() { 316 void Reset() {
318 started_ = false; 317 started_ = false;
319 ended_ = false; 318 ended_ = false;
320 aborted_ = false;
321 } 319 }
322 320
323 private: 321 private:
324 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE { 322 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {
325 started_ = true; 323 started_ = true;
326 } 324 }
327 325
328 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { 326 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE {
329 ended_ = true; 327 ended_ = true;
330 } 328 }
331 329
332 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {
333 aborted_ = true;
334 }
335
336 bool started_; 330 bool started_;
337 bool ended_; 331 bool ended_;
338 bool aborted_;
339 332
340 DISALLOW_COPY_AND_ASSIGN(TestCompositorObserver); 333 DISALLOW_COPY_AND_ASSIGN(TestCompositorObserver);
341 }; 334 };
342 335
343 } // namespace 336 } // namespace
344 337
345 #if defined(OS_WIN) 338 #if defined(OS_WIN)
346 // These are disabled on windows as they don't run correctly on the buildbot. 339 // These are disabled on windows as they don't run correctly on the buildbot.
347 // Reenable once we move to the real compositor. 340 // Reenable once we move to the real compositor.
348 #define MAYBE_Delegate DISABLED_Delegate 341 #define MAYBE_Delegate DISABLED_Delegate
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 // Setting the transform of a layer should alert the observers. 879 // Setting the transform of a layer should alert the observers.
887 observer.Reset(); 880 observer.Reset();
888 Transform transform; 881 Transform transform;
889 transform.ConcatTranslate(-200, -200); 882 transform.ConcatTranslate(-200, -200);
890 transform.ConcatRotate(90.0f); 883 transform.ConcatRotate(90.0f);
891 transform.ConcatTranslate(200, 200); 884 transform.ConcatTranslate(200, 200);
892 l2->SetTransform(transform); 885 l2->SetTransform(transform);
893 RunPendingMessages(); 886 RunPendingMessages();
894 EXPECT_TRUE(observer.notified()); 887 EXPECT_TRUE(observer.notified());
895 888
896 // A change resulting in an aborted swap buffer should alert the observer
897 // and also signal an abort.
898 observer.Reset();
899 l2->SetOpacity(0.1f);
900 GetCompositor()->OnSwapBuffersAborted();
901 RunPendingMessages();
902 EXPECT_TRUE(observer.notified());
903 EXPECT_TRUE(observer.aborted());
904
905 GetCompositor()->RemoveObserver(&observer); 889 GetCompositor()->RemoveObserver(&observer);
906 890
907 // Opacity changes should no longer alert the removed observer. 891 // Opacity changes should no longer alert the removed observer.
908 observer.Reset(); 892 observer.Reset();
909 l2->SetOpacity(0.5f); 893 l2->SetOpacity(0.5f);
910 RunPendingMessages(); 894 RunPendingMessages();
911 EXPECT_FALSE(observer.notified()); 895 EXPECT_FALSE(observer.notified());
912 } 896 }
913 897
914 // Checks that modifying the hierarchy correctly affects final composite. 898 // Checks that modifying the hierarchy correctly affects final composite.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1255
1272 // Resize layer. 1256 // Resize layer.
1273 child->SetBounds(gfx::Rect(200, 200, 400, 400)); 1257 child->SetBounds(gfx::Rect(200, 200, 400, 400));
1274 child->SetVisible(true); 1258 child->SetVisible(true);
1275 EXPECT_TRUE(schedule_draw_invoked_); 1259 EXPECT_TRUE(schedule_draw_invoked_);
1276 DrawTree(root.get()); 1260 DrawTree(root.get());
1277 EXPECT_TRUE(delegate.painted()); 1261 EXPECT_TRUE(delegate.painted());
1278 } 1262 }
1279 1263
1280 } // namespace ui 1264 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animation_observer.h ('k') | ui/gfx/transform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698