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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 GURL start_url(std::string("chrome-extension://") + | 386 GURL start_url(std::string("chrome-extension://") + |
387 last_loaded_extension_id_ + "/test.html"); | 387 last_loaded_extension_id_ + "/test.html"); |
388 ui_test_utils::NavigateToURL(browser(), start_url); | 388 ui_test_utils::NavigateToURL(browser(), start_url); |
389 WebContents* newtab = NULL; | 389 WebContents* newtab = NULL; |
390 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), | 390 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), |
391 start_url.Resolve("newtab.html"), true, &newtab)); | 391 start_url.Resolve("newtab.html"), true, &newtab)); |
392 | 392 |
393 bool result = false; | 393 bool result = false; |
394 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 394 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
395 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); | 395 newtab->GetRenderViewHost(), "", "testExtensionApi()", &result)); |
396 EXPECT_TRUE(result); | 396 EXPECT_TRUE(result); |
397 } | 397 } |
398 | 398 |
399 // Tests that if an extension page calls window.open to an invalid extension | 399 // Tests that if an extension page calls window.open to an invalid extension |
400 // URL, the browser doesn't crash. | 400 // URL, the browser doesn't crash. |
401 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenInvalidExtension) { | 401 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenInvalidExtension) { |
402 ASSERT_TRUE(LoadExtension( | 402 ASSERT_TRUE(LoadExtension( |
403 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); | 403 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); |
404 | 404 |
405 GURL start_url(std::string("chrome-extension://") + | 405 GURL start_url(std::string("chrome-extension://") + |
(...skipping 16 matching lines...) Expand all Loading... |
422 | 422 |
423 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 423 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
424 WebContents* newtab = NULL; | 424 WebContents* newtab = NULL; |
425 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), | 425 ASSERT_NO_FATAL_FAILURE(OpenWindow(chrome::GetActiveWebContents(browser()), |
426 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 426 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
427 "/newtab.html"), false, &newtab)); | 427 "/newtab.html"), false, &newtab)); |
428 | 428 |
429 // Extension API should succeed. | 429 // Extension API should succeed. |
430 bool result = false; | 430 bool result = false; |
431 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 431 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
432 newtab->GetRenderViewHost(), L"", L"testExtensionApi()", &result)); | 432 newtab->GetRenderViewHost(), "", "testExtensionApi()", &result)); |
433 EXPECT_TRUE(result); | 433 EXPECT_TRUE(result); |
434 } | 434 } |
OLD | NEW |