OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 return result; | 880 return result; |
881 } | 881 } |
882 | 882 |
883 int DestroyedCountAndClear() { | 883 int DestroyedCountAndClear() { |
884 int result = destroyed_count_; | 884 int result = destroyed_count_; |
885 destroyed_count_ = 0; | 885 destroyed_count_ = 0; |
886 return result; | 886 return result; |
887 } | 887 } |
888 | 888 |
889 // Return a string representation of the arguments passed in | 889 // Return a string representation of the arguments passed in |
890 // OnPropertyChanged callback. | 890 // OnWindowPropertyChanged callback. |
891 std::string PropertyChangeInfoAndClear() { | 891 std::string PropertyChangeInfoAndClear() { |
892 std::string result( | 892 std::string result( |
893 base::StringPrintf("name=%s old=%ld new=%ld", | 893 base::StringPrintf("name=%s old=%ld new=%ld", |
894 property_name_.c_str(), | 894 property_name_.c_str(), |
895 static_cast<long>(old_property_value_), | 895 static_cast<long>(old_property_value_), |
896 static_cast<long>(new_property_value_))); | 896 static_cast<long>(new_property_value_))); |
897 property_name_.clear(); | 897 property_name_.clear(); |
898 old_property_value_ = 0; | 898 old_property_value_ = 0; |
899 new_property_value_ = 0; | 899 new_property_value_ = 0; |
900 return result; | 900 return result; |
(...skipping 12 matching lines...) Expand all Loading... |
913 bool visible) OVERRIDE { | 913 bool visible) OVERRIDE { |
914 visibility_info_.reset(new VisibilityInfo); | 914 visibility_info_.reset(new VisibilityInfo); |
915 visibility_info_->window_visible = window->IsVisible(); | 915 visibility_info_->window_visible = window->IsVisible(); |
916 visibility_info_->visible_param = visible; | 916 visibility_info_->visible_param = visible; |
917 } | 917 } |
918 | 918 |
919 virtual void OnWindowDestroyed(Window* window) OVERRIDE { | 919 virtual void OnWindowDestroyed(Window* window) OVERRIDE { |
920 destroyed_count_++; | 920 destroyed_count_++; |
921 } | 921 } |
922 | 922 |
923 virtual void OnPropertyChanged(Window* window, | 923 virtual void OnWindowPropertyChanged(Window* window, |
924 const char* name, | 924 const char* name, |
925 void* old) OVERRIDE { | 925 void* old) OVERRIDE { |
926 property_name_ = std::string(name); | 926 property_name_ = std::string(name); |
927 old_property_value_ = reinterpret_cast<intptr_t>(old); | 927 old_property_value_ = reinterpret_cast<intptr_t>(old); |
928 new_property_value_ = reinterpret_cast<intptr_t>(window->GetProperty(name)); | 928 new_property_value_ = reinterpret_cast<intptr_t>(window->GetProperty(name)); |
929 } | 929 } |
930 | 930 |
931 int added_count_; | 931 int added_count_; |
932 int removed_count_; | 932 int removed_count_; |
933 int destroyed_count_; | 933 int destroyed_count_; |
934 scoped_ptr<VisibilityInfo> visibility_info_; | 934 scoped_ptr<VisibilityInfo> visibility_info_; |
935 std::string property_name_; | 935 std::string property_name_; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1086 |
1087 w3->Activate(); | 1087 w3->Activate(); |
1088 EXPECT_EQ(w2.get(), active()); | 1088 EXPECT_EQ(w2.get(), active()); |
1089 | 1089 |
1090 w1->Activate(); | 1090 w1->Activate(); |
1091 EXPECT_EQ(w1.get(), active()); | 1091 EXPECT_EQ(w1.get(), active()); |
1092 } | 1092 } |
1093 | 1093 |
1094 } // namespace test | 1094 } // namespace test |
1095 } // namespace aura | 1095 } // namespace aura |
OLD | NEW |