| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 { | 155 { |
| 156 int modifiers = WebInputEvent::ShiftKey; | 156 int modifiers = WebInputEvent::ShiftKey; |
| 157 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 157 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 158 bool asPopup = true; | 158 bool asPopup = true; |
| 159 EXPECT_EQ(WebNavigationPolicyNewPopup, | 159 EXPECT_EQ(WebNavigationPolicyNewPopup, |
| 160 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 160 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClick) | 163 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClick) |
| 164 { | 164 { |
| 165 #if OS(DARWIN) | 165 #if OS(MACOSX) |
| 166 int modifiers = WebInputEvent::MetaKey; | 166 int modifiers = WebInputEvent::MetaKey; |
| 167 #else | 167 #else |
| 168 int modifiers = WebInputEvent::ControlKey; | 168 int modifiers = WebInputEvent::ControlKey; |
| 169 #endif | 169 #endif |
| 170 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 170 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 171 bool asPopup = false; | 171 bool asPopup = false; |
| 172 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 172 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
| 173 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 173 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 174 } | 174 } |
| 175 | 175 |
| 176 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClickPopup) | 176 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClickPopup) |
| 177 { | 177 { |
| 178 #if OS(DARWIN) | 178 #if OS(MACOSX) |
| 179 int modifiers = WebInputEvent::MetaKey; | 179 int modifiers = WebInputEvent::MetaKey; |
| 180 #else | 180 #else |
| 181 int modifiers = WebInputEvent::ControlKey; | 181 int modifiers = WebInputEvent::ControlKey; |
| 182 #endif | 182 #endif |
| 183 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 183 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 184 bool asPopup = true; | 184 bool asPopup = true; |
| 185 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 185 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
| 186 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 186 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClick) | 189 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClick) |
| 190 { | 190 { |
| 191 #if OS(DARWIN) | 191 #if OS(MACOSX) |
| 192 int modifiers = WebInputEvent::MetaKey; | 192 int modifiers = WebInputEvent::MetaKey; |
| 193 #else | 193 #else |
| 194 int modifiers = WebInputEvent::ControlKey; | 194 int modifiers = WebInputEvent::ControlKey; |
| 195 #endif | 195 #endif |
| 196 modifiers |= WebInputEvent::ShiftKey; | 196 modifiers |= WebInputEvent::ShiftKey; |
| 197 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 197 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 198 bool asPopup = false; | 198 bool asPopup = false; |
| 199 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 199 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
| 200 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 200 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClickPopup) | 203 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClickPopup) |
| 204 { | 204 { |
| 205 #if OS(DARWIN) | 205 #if OS(MACOSX) |
| 206 int modifiers = WebInputEvent::MetaKey; | 206 int modifiers = WebInputEvent::MetaKey; |
| 207 #else | 207 #else |
| 208 int modifiers = WebInputEvent::ControlKey; | 208 int modifiers = WebInputEvent::ControlKey; |
| 209 #endif | 209 #endif |
| 210 modifiers |= WebInputEvent::ShiftKey; | 210 modifiers |= WebInputEvent::ShiftKey; |
| 211 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 211 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 212 bool asPopup = true; | 212 bool asPopup = true; |
| 213 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 213 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
| 214 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 214 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 215 } | 215 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) | 259 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) |
| 260 { | 260 { |
| 261 m_chromeClientImpl->setResizable(false); | 261 m_chromeClientImpl->setResizable(false); |
| 262 EXPECT_TRUE(isNavigationPolicyPopup()); | 262 EXPECT_TRUE(isNavigationPolicyPopup()); |
| 263 m_chromeClientImpl->setResizable(true); | 263 m_chromeClientImpl->setResizable(true); |
| 264 EXPECT_FALSE(isNavigationPolicyPopup()); | 264 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace | 267 } // namespace |
| OLD | NEW |