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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 w121->Focus(); | 882 w121->Focus(); |
883 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); | 883 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); |
884 | 884 |
885 // An attempt to focus 111 should be ignored and w121 should retain focus, | 885 // An attempt to focus 111 should be ignored and w121 should retain focus, |
886 // since a consumes_events_ window with a child is in the z-index above w111. | 886 // since a consumes_events_ window with a child is in the z-index above w111. |
887 EXPECT_FALSE(w111->CanFocus()); | 887 EXPECT_FALSE(w111->CanFocus()); |
888 w111->Focus(); | 888 w111->Focus(); |
889 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); | 889 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); |
890 } | 890 } |
891 | 891 |
892 TEST_F(WindowTest, Fullscreen) { | |
893 gfx::Rect original_bounds = gfx::Rect(100, 100, 100, 100); | |
894 gfx::Rect desktop_bounds(Desktop::GetInstance()->GetHostSize()); | |
895 scoped_ptr<Window> w(CreateTestWindowWithDelegate( | |
896 NULL, 1, original_bounds, NULL)); | |
897 EXPECT_EQ(original_bounds, w->bounds()); | |
898 | |
899 // Restoreing the restored window. | |
900 w->Restore(); | |
901 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
902 EXPECT_EQ(original_bounds, w->bounds()); | |
903 | |
904 // Fullscreen | |
905 w->Fullscreen(); | |
906 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, w->show_state()); | |
907 EXPECT_EQ(desktop_bounds, w->bounds()); | |
908 w->Restore(); | |
909 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
910 EXPECT_EQ(original_bounds, w->bounds()); | |
911 | |
912 // Calling Fullscreen() twice should have no additional effect. | |
913 w->Fullscreen(); | |
914 w->Fullscreen(); | |
915 EXPECT_EQ(desktop_bounds, w->bounds()); | |
916 w->Restore(); | |
917 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
918 EXPECT_EQ(original_bounds, w->bounds()); | |
919 | |
920 // Calling SetBounds() in fullscreen mode should only update the | |
921 // restore bounds not change the bounds of the window. | |
922 gfx::Rect new_bounds(50, 50, 50, 50); | |
923 w->Fullscreen(); | |
924 w->SetBounds(new_bounds); | |
925 EXPECT_EQ(desktop_bounds, w->bounds()); | |
926 w->Restore(); | |
927 EXPECT_EQ(new_bounds, w->bounds()); | |
928 } | |
929 | |
930 TEST_F(WindowTest, Maximized) { | |
931 gfx::Rect original_bounds = gfx::Rect(100, 100, 100, 100); | |
932 gfx::Rect desktop_bounds( | |
933 gfx::Screen::GetMonitorWorkAreaNearestPoint(gfx::Point())); | |
934 scoped_ptr<Window> w(CreateTestWindowWithDelegate( | |
935 NULL, 1, original_bounds, NULL)); | |
936 EXPECT_EQ(original_bounds, w->bounds()); | |
937 | |
938 // Maximized | |
939 w->Maximize(); | |
940 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, w->show_state()); | |
941 gfx::Rect max_bounds(desktop_bounds); | |
942 EXPECT_EQ(max_bounds, w->bounds()); | |
943 w->Restore(); | |
944 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
945 EXPECT_EQ(original_bounds, w->bounds()); | |
946 | |
947 // Maximize twice | |
948 w->Maximize(); | |
949 w->Maximize(); | |
950 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, w->show_state()); | |
951 EXPECT_EQ(max_bounds, w->bounds()); | |
952 w->Restore(); | |
953 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
954 EXPECT_EQ(original_bounds, w->bounds()); | |
955 | |
956 // Maximized -> Fullscreen -> Maximized -> Normal | |
957 w->Maximize(); | |
958 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, w->show_state()); | |
959 EXPECT_EQ(max_bounds, w->bounds()); | |
960 w->Fullscreen(); | |
961 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, w->show_state()); | |
962 EXPECT_EQ(desktop_bounds, w->bounds()); | |
963 w->Maximize(); | |
964 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, w->show_state()); | |
965 EXPECT_EQ(max_bounds, w->bounds()); | |
966 w->Restore(); | |
967 EXPECT_EQ(ui::SHOW_STATE_NORMAL, w->show_state()); | |
968 EXPECT_EQ(original_bounds, w->bounds()); | |
969 | |
970 // Calling SetBounds() in maximized mode mode should only update the | |
971 // restore bounds not change the bounds of the window. | |
972 gfx::Rect new_bounds(50, 50, 50, 50); | |
973 w->Maximize(); | |
974 w->SetBounds(new_bounds); | |
975 EXPECT_EQ(max_bounds, w->bounds()); | |
976 w->Restore(); | |
977 EXPECT_EQ(new_bounds, w->bounds()); | |
978 } | |
979 | |
980 // Various assertions for activating/deactivating. | 892 // Various assertions for activating/deactivating. |
981 TEST_F(WindowTest, Deactivate) { | 893 TEST_F(WindowTest, Deactivate) { |
982 TestWindowDelegate d1; | 894 TestWindowDelegate d1; |
983 TestWindowDelegate d2; | 895 TestWindowDelegate d2; |
984 scoped_ptr<Window> w1( | 896 scoped_ptr<Window> w1( |
985 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(), NULL)); | 897 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(), NULL)); |
986 scoped_ptr<Window> w2( | 898 scoped_ptr<Window> w2( |
987 CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(), NULL)); | 899 CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(), NULL)); |
988 Window* parent = w1->parent(); | 900 Window* parent = w1->parent(); |
989 parent->Show(); | 901 parent->Show(); |
(...skipping 11 matching lines...) Expand all Loading... |
1001 EXPECT_FALSE(w2->IsActive()); | 913 EXPECT_FALSE(w2->IsActive()); |
1002 EXPECT_EQ(w1.get(), parent->children()[1]); | 914 EXPECT_EQ(w1.get(), parent->children()[1]); |
1003 | 915 |
1004 // Deactivate w1 and make sure w2 becomes active and frontmost. | 916 // Deactivate w1 and make sure w2 becomes active and frontmost. |
1005 w1->Deactivate(); | 917 w1->Deactivate(); |
1006 EXPECT_FALSE(w1->IsActive()); | 918 EXPECT_FALSE(w1->IsActive()); |
1007 EXPECT_TRUE(w2->IsActive()); | 919 EXPECT_TRUE(w2->IsActive()); |
1008 EXPECT_EQ(w2.get(), parent->children()[1]); | 920 EXPECT_EQ(w2.get(), parent->children()[1]); |
1009 } | 921 } |
1010 | 922 |
1011 TEST_F(WindowTest, IsOrContainsFullscreenWindow) { | |
1012 scoped_ptr<Window> w1( | |
1013 CreateTestWindowWithDelegate(NULL, 1, gfx::Rect(0, 0, 100, 100), NULL)); | |
1014 scoped_ptr<Window> w11( | |
1015 CreateTestWindow(SK_ColorWHITE, 11, gfx::Rect(0, 0, 10, 10), w1.get())); | |
1016 | |
1017 Window* root = Desktop::GetInstance(); | |
1018 EXPECT_FALSE(root->IsOrContainsFullscreenWindow()); | |
1019 | |
1020 w11->Fullscreen(); | |
1021 EXPECT_TRUE(root->IsOrContainsFullscreenWindow()); | |
1022 | |
1023 w11->Hide(); | |
1024 EXPECT_FALSE(root->IsOrContainsFullscreenWindow()); | |
1025 } | |
1026 | |
1027 #if !defined(OS_WIN) | 923 #if !defined(OS_WIN) |
1028 // Tests transformation on the desktop. | 924 // Tests transformation on the desktop. |
1029 TEST_F(WindowTest, Transform) { | 925 TEST_F(WindowTest, Transform) { |
1030 Desktop* desktop = Desktop::GetInstance(); | 926 Desktop* desktop = Desktop::GetInstance(); |
1031 desktop->ShowDesktop(); | 927 desktop->ShowDesktop(); |
1032 gfx::Size size = desktop->GetHostSize(); | 928 gfx::Size size = desktop->GetHostSize(); |
1033 EXPECT_EQ(gfx::Rect(size), | 929 EXPECT_EQ(gfx::Rect(size), |
1034 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point())); | 930 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point())); |
1035 | 931 |
1036 // Rotate it clock-wise 90 degrees. | 932 // Rotate it clock-wise 90 degrees. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 TEST_F(ToplevelWindowTest, TopMostActivate) { | 1036 TEST_F(ToplevelWindowTest, TopMostActivate) { |
1141 ActivateWindowDelegate activate; | 1037 ActivateWindowDelegate activate; |
1142 ActivateWindowDelegate non_activate(false); | 1038 ActivateWindowDelegate non_activate(false); |
1143 | 1039 |
1144 scoped_ptr<Window> w1(CreateTestToplevelWindow(&non_activate, gfx::Rect())); | 1040 scoped_ptr<Window> w1(CreateTestToplevelWindow(&non_activate, gfx::Rect())); |
1145 scoped_ptr<Window> w2(CreateTestToplevelWindow(&activate, gfx::Rect())); | 1041 scoped_ptr<Window> w2(CreateTestToplevelWindow(&activate, gfx::Rect())); |
1146 scoped_ptr<Window> w3(CreateTestToplevelWindow(&non_activate, gfx::Rect())); | 1042 scoped_ptr<Window> w3(CreateTestToplevelWindow(&non_activate, gfx::Rect())); |
1147 EXPECT_EQ(w2.get(), toplevel_container_.GetTopmostWindowToActivate(NULL)); | 1043 EXPECT_EQ(w2.get(), toplevel_container_.GetTopmostWindowToActivate(NULL)); |
1148 } | 1044 } |
1149 | 1045 |
1150 // Tests that maximized windows get resized after desktop is resized. | |
1151 TEST_F(ToplevelWindowTest, MaximizeAfterDesktopResize) { | |
1152 gfx::Rect window_bounds(10, 10, 300, 400); | |
1153 scoped_ptr<Window> w1(CreateTestToplevelWindow(NULL, window_bounds)); | |
1154 | |
1155 w1->Show(); | |
1156 EXPECT_EQ(window_bounds, w1->bounds()); | |
1157 | |
1158 w1->Maximize(); | |
1159 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(w1.get()), | |
1160 w1->bounds()); | |
1161 | |
1162 // Resize the desktop. | |
1163 Desktop* desktop = Desktop::GetInstance(); | |
1164 gfx::Size desktop_size = desktop->GetHostSize(); | |
1165 desktop->SetBounds(gfx::Rect(0, 0, desktop_size.width() + 100, | |
1166 desktop_size.height() + 200)); | |
1167 | |
1168 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(w1.get()), | |
1169 w1->bounds()); | |
1170 | |
1171 w1->Restore(); | |
1172 EXPECT_EQ(window_bounds, w1->bounds()); | |
1173 } | |
1174 | |
1175 // Tests that fullscreen windows get resized after desktop is resized. | |
1176 TEST_F(ToplevelWindowTest, FullscreenAfterDesktopResize) { | |
1177 gfx::Rect window_bounds(10, 10, 300, 400); | |
1178 scoped_ptr<Window> w1(CreateTestToplevelWindow(NULL, window_bounds)); | |
1179 | |
1180 w1->Show(); | |
1181 EXPECT_EQ(window_bounds, w1->bounds()); | |
1182 | |
1183 w1->Fullscreen(); | |
1184 EXPECT_EQ(gfx::Screen::GetMonitorAreaNearestWindow(w1.get()), w1->bounds()); | |
1185 | |
1186 // Resize the desktop. | |
1187 Desktop* desktop = Desktop::GetInstance(); | |
1188 gfx::Size desktop_size = desktop->GetHostSize(); | |
1189 desktop->SetBounds(gfx::Rect(0, 0, desktop_size.width() + 100, | |
1190 desktop_size.height() + 200)); | |
1191 | |
1192 EXPECT_EQ(gfx::Screen::GetMonitorAreaNearestWindow(w1.get()), w1->bounds()); | |
1193 | |
1194 w1->Restore(); | |
1195 EXPECT_EQ(window_bounds, w1->bounds()); | |
1196 } | |
1197 | |
1198 TEST_F(WindowTest, Property) { | 1046 TEST_F(WindowTest, Property) { |
1199 scoped_ptr<Window> w(CreateTestWindowWithId(0, NULL)); | 1047 scoped_ptr<Window> w(CreateTestWindowWithId(0, NULL)); |
1200 const char* key = "test"; | 1048 const char* key = "test"; |
1201 EXPECT_EQ(NULL, w->GetProperty(key)); | 1049 EXPECT_EQ(NULL, w->GetProperty(key)); |
| 1050 EXPECT_EQ(0, w->GetIntProperty(key)); |
1202 | 1051 |
1203 void* value = reinterpret_cast<void*>(static_cast<intptr_t>(1)); | 1052 w->SetIntProperty(key, 1); |
1204 w->SetProperty(key, value); | 1053 EXPECT_EQ(1, w->GetIntProperty(key)); |
1205 EXPECT_EQ(value, w->GetProperty(key)); | 1054 EXPECT_EQ(reinterpret_cast<void*>(static_cast<intptr_t>(1)), |
| 1055 w->GetProperty(key)); |
1206 | 1056 |
1207 // Overwrite the property with different value type. | 1057 // Overwrite the property with different value type. |
1208 w->SetProperty(key, static_cast<void*>(const_cast<char*>("string"))); | 1058 w->SetProperty(key, static_cast<void*>(const_cast<char*>("string"))); |
1209 std::string expected("string"); | 1059 std::string expected("string"); |
1210 EXPECT_EQ(expected, | 1060 EXPECT_EQ(expected, static_cast<const char*>(w->GetProperty(key))); |
1211 static_cast<const char*>(w->GetProperty(key))); | |
1212 | 1061 |
1213 // Non-existent property. | 1062 // Non-existent property. |
1214 EXPECT_EQ(NULL, w->GetProperty("foo")); | 1063 EXPECT_EQ(NULL, w->GetProperty("foo")); |
| 1064 EXPECT_EQ(0, w->GetIntProperty("foo")); |
1215 | 1065 |
1216 // Set NULL and make sure the property is gone. | 1066 // Set NULL and make sure the property is gone. |
1217 w->SetProperty(key, NULL); | 1067 w->SetProperty(key, NULL); |
1218 EXPECT_EQ(NULL, w->GetProperty(key)); | 1068 EXPECT_EQ(NULL, w->GetProperty(key)); |
| 1069 EXPECT_EQ(0, w->GetIntProperty(key)); |
1219 } | 1070 } |
1220 | 1071 |
1221 class WindowObserverTest : public WindowTest, | 1072 class WindowObserverTest : public WindowTest, |
1222 public WindowObserver { | 1073 public WindowObserver { |
1223 public: | 1074 public: |
1224 struct VisibilityInfo { | 1075 struct VisibilityInfo { |
1225 bool window_visible; | 1076 bool window_visible; |
1226 bool visible_param; | 1077 bool visible_param; |
1227 }; | 1078 }; |
1228 | 1079 |
1229 WindowObserverTest() | 1080 WindowObserverTest() |
1230 : added_count_(0), | 1081 : added_count_(0), |
1231 removed_count_(0), | 1082 removed_count_(0), |
1232 destroyed_count_(0) { | 1083 destroyed_count_(0), |
| 1084 old_property_value_(NULL), |
| 1085 new_property_value_(NULL) { |
1233 } | 1086 } |
1234 | 1087 |
1235 virtual ~WindowObserverTest() {} | 1088 virtual ~WindowObserverTest() {} |
1236 | 1089 |
1237 const VisibilityInfo* GetVisibilityInfo() const { | 1090 const VisibilityInfo* GetVisibilityInfo() const { |
1238 return visibility_info_.get(); | 1091 return visibility_info_.get(); |
1239 } | 1092 } |
1240 | 1093 |
1241 void ResetVisibilityInfo() { | 1094 void ResetVisibilityInfo() { |
1242 visibility_info_.reset(); | 1095 visibility_info_.reset(); |
1243 } | 1096 } |
1244 | 1097 |
1245 // Returns a description of the WindowObserver methods that have been invoked. | 1098 // Returns a description of the WindowObserver methods that have been invoked. |
1246 std::string WindowObserverCountStateAndClear() { | 1099 std::string WindowObserverCountStateAndClear() { |
1247 std::string result( | 1100 std::string result( |
1248 base::StringPrintf("added=%d removed=%d", | 1101 base::StringPrintf("added=%d removed=%d", |
1249 added_count_, removed_count_)); | 1102 added_count_, removed_count_)); |
1250 added_count_ = removed_count_ = 0; | 1103 added_count_ = removed_count_ = 0; |
1251 return result; | 1104 return result; |
1252 } | 1105 } |
1253 | 1106 |
1254 int DestroyedCountAndClear() { | 1107 int DestroyedCountAndClear() { |
1255 int result = destroyed_count_; | 1108 int result = destroyed_count_; |
1256 destroyed_count_ = 0; | 1109 destroyed_count_ = 0; |
1257 return result; | 1110 return result; |
1258 } | 1111 } |
1259 | 1112 |
| 1113 // Return a string representation of the arguments passed in |
| 1114 // OnPropertyChanged callback. |
| 1115 std::string PropertyChangeInfoAndClear() { |
| 1116 std::string result( |
| 1117 base::StringPrintf("name=%s old=%p new=%p", |
| 1118 property_name_.c_str(), |
| 1119 old_property_value_, |
| 1120 new_property_value_)); |
| 1121 property_name_.clear(); |
| 1122 old_property_value_ = NULL; |
| 1123 new_property_value_ = NULL; |
| 1124 return result; |
| 1125 } |
| 1126 |
1260 private: | 1127 private: |
1261 virtual void OnWindowAdded(Window* new_window) OVERRIDE { | 1128 virtual void OnWindowAdded(Window* new_window) OVERRIDE { |
1262 added_count_++; | 1129 added_count_++; |
1263 } | 1130 } |
1264 | 1131 |
1265 virtual void OnWillRemoveWindow(Window* window) OVERRIDE { | 1132 virtual void OnWillRemoveWindow(Window* window) OVERRIDE { |
1266 removed_count_++; | 1133 removed_count_++; |
1267 } | 1134 } |
1268 | 1135 |
1269 virtual void OnWindowVisibilityChanged(Window* window, | 1136 virtual void OnWindowVisibilityChanged(Window* window, |
1270 bool visible) OVERRIDE { | 1137 bool visible) OVERRIDE { |
1271 visibility_info_.reset(new VisibilityInfo); | 1138 visibility_info_.reset(new VisibilityInfo); |
1272 visibility_info_->window_visible = window->IsVisible(); | 1139 visibility_info_->window_visible = window->IsVisible(); |
1273 visibility_info_->visible_param = visible; | 1140 visibility_info_->visible_param = visible; |
1274 } | 1141 } |
1275 | 1142 |
1276 virtual void OnWindowDestroyed(Window* window) OVERRIDE { | 1143 virtual void OnWindowDestroyed(Window* window) OVERRIDE { |
1277 destroyed_count_++; | 1144 destroyed_count_++; |
1278 } | 1145 } |
1279 | 1146 |
| 1147 virtual void OnPropertyChanged(Window* window, |
| 1148 const char* name, |
| 1149 void* old) OVERRIDE { |
| 1150 property_name_ = std::string(name); |
| 1151 old_property_value_ = old; |
| 1152 new_property_value_ = window->GetProperty(name); |
| 1153 } |
| 1154 |
1280 int added_count_; | 1155 int added_count_; |
1281 int removed_count_; | 1156 int removed_count_; |
1282 int destroyed_count_; | 1157 int destroyed_count_; |
1283 scoped_ptr<VisibilityInfo> visibility_info_; | 1158 scoped_ptr<VisibilityInfo> visibility_info_; |
| 1159 std::string property_name_; |
| 1160 void* old_property_value_; |
| 1161 void* new_property_value_; |
1284 | 1162 |
1285 DISALLOW_COPY_AND_ASSIGN(WindowObserverTest); | 1163 DISALLOW_COPY_AND_ASSIGN(WindowObserverTest); |
1286 }; | 1164 }; |
1287 | 1165 |
1288 // Various assertions for WindowObserver. | 1166 // Various assertions for WindowObserver. |
1289 TEST_F(WindowObserverTest, WindowObserver) { | 1167 TEST_F(WindowObserverTest, WindowObserver) { |
1290 scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); | 1168 scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); |
1291 w1->AddObserver(this); | 1169 w1->AddObserver(this); |
1292 | 1170 |
1293 // Create a new window as a child of w1, our observer should be notified. | 1171 // Create a new window as a child of w1, our observer should be notified. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 EXPECT_EQ(1, DestroyedCountAndClear()); | 1238 EXPECT_EQ(1, DestroyedCountAndClear()); |
1361 | 1239 |
1362 // Observe on child and delete parent window should fire a notification. | 1240 // Observe on child and delete parent window should fire a notification. |
1363 scoped_ptr<Window> parent(CreateTestWindowWithId(1, NULL)); | 1241 scoped_ptr<Window> parent(CreateTestWindowWithId(1, NULL)); |
1364 Window* child = CreateTestWindowWithId(1, parent.get()); // owned by parent | 1242 Window* child = CreateTestWindowWithId(1, parent.get()); // owned by parent |
1365 child->AddObserver(this); | 1243 child->AddObserver(this); |
1366 parent.reset(); | 1244 parent.reset(); |
1367 EXPECT_EQ(1, DestroyedCountAndClear()); | 1245 EXPECT_EQ(1, DestroyedCountAndClear()); |
1368 } | 1246 } |
1369 | 1247 |
| 1248 TEST_F(WindowObserverTest, PropertyChanged) { |
| 1249 // Setting property should fire a property change notification. |
| 1250 scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); |
| 1251 w1->AddObserver(this); |
| 1252 w1->SetIntProperty("test", 1); |
| 1253 EXPECT_EQ("name=test old=(nil) new=0x1", PropertyChangeInfoAndClear()); |
| 1254 w1->SetIntProperty("test", 2); |
| 1255 EXPECT_EQ("name=test old=0x1 new=0x2", PropertyChangeInfoAndClear()); |
| 1256 w1->SetProperty("test", NULL); |
| 1257 EXPECT_EQ("name=test old=0x2 new=(nil)", PropertyChangeInfoAndClear()); |
| 1258 |
| 1259 // Sanity check to see if |PropertyChangeInfoAndClear| really clears. |
| 1260 EXPECT_EQ("name= old=(nil) new=(nil)", PropertyChangeInfoAndClear()); |
| 1261 } |
| 1262 |
1370 class DesktopObserverTest : public WindowTest, | 1263 class DesktopObserverTest : public WindowTest, |
1371 public DesktopObserver { | 1264 public DesktopObserver { |
1372 public: | 1265 public: |
1373 DesktopObserverTest() : active_(NULL) { | 1266 DesktopObserverTest() : active_(NULL) { |
1374 } | 1267 } |
1375 | 1268 |
1376 virtual ~DesktopObserverTest() {} | 1269 virtual ~DesktopObserverTest() {} |
1377 | 1270 |
1378 Window* active() const { return active_; } | 1271 Window* active() const { return active_; } |
1379 | 1272 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 | 1306 |
1414 w3->Activate(); | 1307 w3->Activate(); |
1415 EXPECT_EQ(w2.get(), active()); | 1308 EXPECT_EQ(w2.get(), active()); |
1416 | 1309 |
1417 w1->Activate(); | 1310 w1->Activate(); |
1418 EXPECT_EQ(w1.get(), active()); | 1311 EXPECT_EQ(w1.get(), active()); |
1419 } | 1312 } |
1420 | 1313 |
1421 } // namespace test | 1314 } // namespace test |
1422 } // namespace aura | 1315 } // namespace aura |
OLD | NEW |