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 "chrome/browser/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 extension_tabs_module_constants::kIncognitoModeIsDisabled)); | 247 extension_tabs_module_constants::kIncognitoModeIsDisabled)); |
248 | 248 |
249 // Run in incognito window. | 249 // Run in incognito window. |
250 EXPECT_TRUE(MatchPattern( | 250 EXPECT_TRUE(MatchPattern( |
251 RunFunctionAndReturnError( | 251 RunFunctionAndReturnError( |
252 new CreateWindowFunction(), | 252 new CreateWindowFunction(), |
253 kArgs, | 253 kArgs, |
254 incognito_browser), | 254 incognito_browser), |
255 extension_tabs_module_constants::kIncognitoModeIsDisabled)); | 255 extension_tabs_module_constants::kIncognitoModeIsDisabled)); |
256 } | 256 } |
| 257 |
| 258 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { |
| 259 static const char kArgsMinimizedWithFocus[] = |
| 260 "[%u, {\"state\": \"minimized\", \"focused\": true}]"; |
| 261 static const char kArgsMaximizedWithoutFocus[] = |
| 262 "[%u, {\"state\": \"maximized\", \"focused\": false}]"; |
| 263 static const char kArgsMinimizedWithBounds[] = |
| 264 "[%u, {\"state\": \"minimized\", \"width\": 500}]"; |
| 265 static const char kArgsMaximizedWithBounds[] = |
| 266 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; |
| 267 int window_id = ExtensionTabUtil::GetWindowId(browser()); |
| 268 |
| 269 EXPECT_TRUE(MatchPattern( |
| 270 RunFunctionAndReturnError( |
| 271 new UpdateWindowFunction(), |
| 272 base::StringPrintf(kArgsMinimizedWithFocus, window_id), |
| 273 browser()), |
| 274 extension_tabs_module_constants::kInvalidWindowStateError)); |
| 275 |
| 276 EXPECT_TRUE(MatchPattern( |
| 277 RunFunctionAndReturnError( |
| 278 new UpdateWindowFunction(), |
| 279 base::StringPrintf(kArgsMaximizedWithoutFocus, window_id), |
| 280 browser()), |
| 281 extension_tabs_module_constants::kInvalidWindowStateError)); |
| 282 |
| 283 EXPECT_TRUE(MatchPattern( |
| 284 RunFunctionAndReturnError( |
| 285 new UpdateWindowFunction(), |
| 286 base::StringPrintf(kArgsMinimizedWithBounds, window_id), |
| 287 browser()), |
| 288 extension_tabs_module_constants::kInvalidWindowStateError)); |
| 289 |
| 290 EXPECT_TRUE(MatchPattern( |
| 291 RunFunctionAndReturnError( |
| 292 new UpdateWindowFunction(), |
| 293 base::StringPrintf(kArgsMaximizedWithBounds, window_id), |
| 294 browser()), |
| 295 extension_tabs_module_constants::kInvalidWindowStateError)); |
| 296 } |
OLD | NEW |