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/strings/stringprintf.h" | 7 #include "base/strings/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" |
11 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
12 #include "chrome/browser/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_iterator.h" | 15 #include "chrome/browser/ui/browser_iterator.h" |
16 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #include "chrome/browser/ui/panels/panel_manager.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
20 #include "chrome/test/base/test_switches.h" | 20 #include "chrome/test/base/test_switches.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
25 #include "content/public/test/browser_test_utils.h" | 25 #include "content/public/test/browser_test_utils.h" |
| 26 #include "extensions/common/switches.h" |
26 #include "net/dns/mock_host_resolver.h" | 27 #include "net/dns/mock_host_resolver.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
28 | 29 |
29 #if defined(USE_ASH) | 30 #if defined(USE_ASH) |
30 #include "chrome/browser/extensions/shell_window_registry.h" | 31 #include "chrome/browser/extensions/shell_window_registry.h" |
31 #endif | 32 #endif |
32 | 33 |
33 #if defined(USE_ASH) && !defined(OS_WIN) | 34 #if defined(USE_ASH) && !defined(OS_WIN) |
34 // TODO(stevenjb): Figure out the correct behavior for Ash + Win | 35 // TODO(stevenjb): Figure out the correct behavior for Ash + Win |
35 #define USE_ASH_PANELS | 36 #define USE_ASH_PANELS |
36 #endif | 37 #endif |
37 | 38 |
38 using content::OpenURLParams; | 39 using content::OpenURLParams; |
39 using content::Referrer; | 40 using content::Referrer; |
40 using content::WebContents; | 41 using content::WebContents; |
41 | 42 |
42 // Disabled, http://crbug.com/64899. | 43 // Disabled, http://crbug.com/64899. |
43 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { | 44 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { |
44 CommandLine::ForCurrentProcess()->AppendSwitch( | 45 CommandLine::ForCurrentProcess()->AppendSwitch( |
45 switches::kEnableExperimentalExtensionApis); | 46 extensions::switches::kEnableExperimentalExtensionApis); |
46 | 47 |
47 ResultCatcher catcher; | 48 ResultCatcher catcher; |
48 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ | 49 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ |
49 .AppendASCII("window_open").AppendASCII("spanning"))); | 50 .AppendASCII("window_open").AppendASCII("spanning"))); |
50 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 51 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
51 } | 52 } |
52 | 53 |
53 int GetPanelCount(Browser* browser) { | 54 int GetPanelCount(Browser* browser) { |
54 #if defined(USE_ASH_PANELS) | 55 #if defined(USE_ASH_PANELS) |
55 return static_cast<int>(extensions::ShellWindowRegistry::Get( | 56 return static_cast<int>(extensions::ShellWindowRegistry::Get( |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), | 469 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), |
469 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 470 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |
470 "/newtab.html"), false, &newtab)); | 471 "/newtab.html"), false, &newtab)); |
471 | 472 |
472 // Extension API should succeed. | 473 // Extension API should succeed. |
473 bool result = false; | 474 bool result = false; |
474 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 475 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
475 &result)); | 476 &result)); |
476 EXPECT_TRUE(result); | 477 EXPECT_TRUE(result); |
477 } | 478 } |
OLD | NEW |