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

Side by Side Diff: mojo/services/view_manager/public/cpp/tests/view_unittest.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
« no previous file with comments | « mojo/public/python/src/common.h ('k') | mojo/services/view_manager/public/cpp/view_tracker.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 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 "mojo/services/view_manager/public/cpp/view.h" 5 #include "mojo/services/view_manager/public/cpp/view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "mojo/services/view_manager/public/cpp/lib/view_private.h" 9 #include "mojo/services/view_manager/public/cpp/lib/view_private.h"
10 #include "mojo/services/view_manager/public/cpp/util.h" 10 #include "mojo/services/view_manager/public/cpp/util.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 735 }
736 } 736 }
737 737
738 namespace { 738 namespace {
739 739
740 class SharedPropertyChangeObserver : public ViewObserver { 740 class SharedPropertyChangeObserver : public ViewObserver {
741 public: 741 public:
742 explicit SharedPropertyChangeObserver(View* view) : view_(view) { 742 explicit SharedPropertyChangeObserver(View* view) : view_(view) {
743 view_->AddObserver(this); 743 view_->AddObserver(this);
744 } 744 }
745 virtual ~SharedPropertyChangeObserver() { view_->RemoveObserver(this); } 745 ~SharedPropertyChangeObserver() override { view_->RemoveObserver(this); }
746 746
747 Changes GetAndClearChanges() { 747 Changes GetAndClearChanges() {
748 Changes changes; 748 Changes changes;
749 changes.swap(changes_); 749 changes.swap(changes_);
750 return changes; 750 return changes;
751 } 751 }
752 752
753 private: 753 private:
754 // Overridden from ViewObserver: 754 // Overridden from ViewObserver:
755 void OnViewSharedPropertyChanged( 755 void OnViewSharedPropertyChanged(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 typedef std::pair<const void*, intptr_t> PropertyChangeInfo; 828 typedef std::pair<const void*, intptr_t> PropertyChangeInfo;
829 829
830 class LocalPropertyChangeObserver : public ViewObserver { 830 class LocalPropertyChangeObserver : public ViewObserver {
831 public: 831 public:
832 explicit LocalPropertyChangeObserver(View* view) 832 explicit LocalPropertyChangeObserver(View* view)
833 : view_(view), 833 : view_(view),
834 property_key_(nullptr), 834 property_key_(nullptr),
835 old_property_value_(-1) { 835 old_property_value_(-1) {
836 view_->AddObserver(this); 836 view_->AddObserver(this);
837 } 837 }
838 virtual ~LocalPropertyChangeObserver() { view_->RemoveObserver(this); } 838 ~LocalPropertyChangeObserver() override { view_->RemoveObserver(this); }
839 839
840 PropertyChangeInfo PropertyChangeInfoAndClear() { 840 PropertyChangeInfo PropertyChangeInfoAndClear() {
841 PropertyChangeInfo result(property_key_, old_property_value_); 841 PropertyChangeInfo result(property_key_, old_property_value_);
842 property_key_ = NULL; 842 property_key_ = NULL;
843 old_property_value_ = -3; 843 old_property_value_ = -3;
844 return result; 844 return result;
845 } 845 }
846 846
847 private: 847 private:
848 void OnViewLocalPropertyChanged(View* window, 848 void OnViewLocalPropertyChanged(View* window,
(...skipping 26 matching lines...) Expand all
875 EXPECT_EQ(PropertyChangeInfo(&prop, -2), o.PropertyChangeInfoAndClear()); 875 EXPECT_EQ(PropertyChangeInfo(&prop, -2), o.PropertyChangeInfoAndClear());
876 v1.ClearLocalProperty(&prop); 876 v1.ClearLocalProperty(&prop);
877 EXPECT_EQ(PropertyChangeInfo(&prop, 3), o.PropertyChangeInfoAndClear()); 877 EXPECT_EQ(PropertyChangeInfo(&prop, 3), o.PropertyChangeInfoAndClear());
878 878
879 // Sanity check to see if |PropertyChangeInfoAndClear| really clears. 879 // Sanity check to see if |PropertyChangeInfoAndClear| really clears.
880 EXPECT_EQ(PropertyChangeInfo( 880 EXPECT_EQ(PropertyChangeInfo(
881 reinterpret_cast<const void*>(NULL), -3), o.PropertyChangeInfoAndClear()); 881 reinterpret_cast<const void*>(NULL), -3), o.PropertyChangeInfoAndClear());
882 } 882 }
883 883
884 } // namespace mojo 884 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/python/src/common.h ('k') | mojo/services/view_manager/public/cpp/view_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698