| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/window_list_provider_impl.h" | 5 #include "athena/wm/window_list_provider_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "athena/test/base/athena_test_base.h" | 9 #include "athena/test/base/athena_test_base.h" |
| 10 #include "athena/wm/public/window_list_provider_observer.h" | 10 #include "athena/wm/public/window_list_provider_observer.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 provider_->AddObserver(this); | 57 provider_->AddObserver(this); |
| 58 } | 58 } |
| 59 virtual ~WindowListObserver() { | 59 virtual ~WindowListObserver() { |
| 60 provider_->RemoveObserver(this); | 60 provider_->RemoveObserver(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 int calls() const { return calls_; } | 63 int calls() const { return calls_; } |
| 64 int window_removal_calls() const { return window_removal_calls_; } | 64 int window_removal_calls() const { return window_removal_calls_; } |
| 65 | 65 |
| 66 // WindowListProviderObserver: | 66 // WindowListProviderObserver: |
| 67 virtual void OnWindowStackingChanged() OVERRIDE { | 67 virtual void OnWindowStackingChanged() override { |
| 68 calls_++; | 68 calls_++; |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void OnWindowRemoved(aura::Window* removed_window, | 71 virtual void OnWindowRemoved(aura::Window* removed_window, |
| 72 int index) OVERRIDE { | 72 int index) override { |
| 73 window_removal_calls_++; | 73 window_removal_calls_++; |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // The number of calls to the observer. | 77 // The number of calls to the observer. |
| 78 int calls_; | 78 int calls_; |
| 79 int window_removal_calls_; | 79 int window_removal_calls_; |
| 80 | 80 |
| 81 // The associated WindowListProvider which is observed. | 81 // The associated WindowListProvider which is observed. |
| 82 WindowListProvider* provider_; | 82 WindowListProvider* provider_; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 window1.reset(); | 281 window1.reset(); |
| 282 ASSERT_EQ(1U, list_provider->GetWindowList().size()); | 282 ASSERT_EQ(1U, list_provider->GetWindowList().size()); |
| 283 EXPECT_EQ(2, observer->window_removal_calls()); | 283 EXPECT_EQ(2, observer->window_removal_calls()); |
| 284 | 284 |
| 285 window3.reset(); | 285 window3.reset(); |
| 286 ASSERT_EQ(0U, list_provider->GetWindowList().size()); | 286 ASSERT_EQ(0U, list_provider->GetWindowList().size()); |
| 287 EXPECT_EQ(3, observer->window_removal_calls()); | 287 EXPECT_EQ(3, observer->window_removal_calls()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace athena | 290 } // namespace athena |
| OLD | NEW |