| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // Expect one panel (opened by extension) and one tab (from the panel calling | 395 // Expect one panel (opened by extension) and one tab (from the panel calling |
| 396 // window.open). Panels modify the WindowOpenDisposition in window.open | 396 // window.open). Panels modify the WindowOpenDisposition in window.open |
| 397 // to always open in a tab. | 397 // to always open in a tab. |
| 398 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, 0, 1)); | 398 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, 0, 1)); |
| 399 } | 399 } |
| 400 | 400 |
| 401 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpener) { | 401 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpener) { |
| 402 ASSERT_TRUE(RunExtensionTest("window_open/opener")) << message_; | 402 ASSERT_TRUE(RunExtensionTest("window_open/opener")) << message_; |
| 403 } | 403 } |
| 404 | 404 |
| 405 #if defined(OS_MACOSX) |
| 406 // Extension popup windows are incorrectly sized on OSX, crbug.com/225601 |
| 407 #define MAYBE_WindowOpenSized DISABLED_WindowOpenSized |
| 408 #else |
| 409 #define MAYBE_WindowOpenSized WindowOpenSized |
| 410 #endif |
| 411 // Ensure that the width and height properties of a window opened with |
| 412 // chrome.windows.create match the creation parameters. See crbug.com/173831. |
| 413 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_WindowOpenSized) { |
| 414 ASSERT_TRUE(RunExtensionTest("window_open/window_size")) << message_; |
| 415 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 0, 1, 0)); |
| 416 } |
| 417 |
| 405 // Tests that an extension page can call window.open to an extension URL and | 418 // Tests that an extension page can call window.open to an extension URL and |
| 406 // the new window has extension privileges. | 419 // the new window has extension privileges. |
| 407 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) { | 420 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) { |
| 408 ASSERT_TRUE(LoadExtension( | 421 ASSERT_TRUE(LoadExtension( |
| 409 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); | 422 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); |
| 410 | 423 |
| 411 GURL start_url(std::string("chrome-extension://") + | 424 GURL start_url(std::string("chrome-extension://") + |
| 412 last_loaded_extension_id_ + "/test.html"); | 425 last_loaded_extension_id_ + "/test.html"); |
| 413 ui_test_utils::NavigateToURL(browser(), start_url); | 426 ui_test_utils::NavigateToURL(browser(), start_url); |
| 414 WebContents* newtab = NULL; | 427 WebContents* newtab = NULL; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 466 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), |
| 454 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 467 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
| 455 "/newtab.html"), false, &newtab)); | 468 "/newtab.html"), false, &newtab)); |
| 456 | 469 |
| 457 // Extension API should succeed. | 470 // Extension API should succeed. |
| 458 bool result = false; | 471 bool result = false; |
| 459 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 472 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
| 460 &result)); | 473 &result)); |
| 461 EXPECT_TRUE(result); | 474 EXPECT_TRUE(result); |
| 462 } | 475 } |
| OLD | NEW |