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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "content/public/common/result_codes.h" | 23 #include "content/public/common/result_codes.h" |
24 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
25 #include "content/public/test/browser_test_utils.h" | 25 #include "content/public/test/browser_test_utils.h" |
26 #include "extensions/browser/extension_host.h" | 26 #include "extensions/browser/extension_host.h" |
27 #include "extensions/browser/extension_system.h" | 27 #include "extensions/browser/extension_system.h" |
28 #include "extensions/browser/process_manager.h" | 28 #include "extensions/browser/process_manager.h" |
29 #include "extensions/common/constants.h" | 29 #include "extensions/common/constants.h" |
30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
31 #include "extensions/common/switches.h" | 31 #include "extensions/common/switches.h" |
| 32 #include "extensions/test/result_catcher.h" |
32 #include "net/dns/mock_host_resolver.h" | 33 #include "net/dns/mock_host_resolver.h" |
33 #include "net/test/embedded_test_server/embedded_test_server.h" | 34 #include "net/test/embedded_test_server/embedded_test_server.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
35 | 36 |
36 #if defined(USE_ASH) | 37 #if defined(USE_ASH) |
37 #include "extensions/browser/app_window/app_window_registry.h" | 38 #include "extensions/browser/app_window/app_window_registry.h" |
38 #endif | 39 #endif |
39 | 40 |
40 #if defined(USE_ASH) && defined(OS_CHROMEOS) | 41 #if defined(USE_ASH) && defined(OS_CHROMEOS) |
41 // TODO(stevenjb): Figure out the correct behavior for Ash + Win | 42 // TODO(stevenjb): Figure out the correct behavior for Ash + Win |
42 #define USE_ASH_PANELS | 43 #define USE_ASH_PANELS |
43 #endif | 44 #endif |
44 | 45 |
45 using content::OpenURLParams; | 46 using content::OpenURLParams; |
46 using content::Referrer; | 47 using content::Referrer; |
47 using content::WebContents; | 48 using content::WebContents; |
48 | 49 |
49 // Disabled, http://crbug.com/64899. | 50 // Disabled, http://crbug.com/64899. |
50 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { | 51 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { |
51 CommandLine::ForCurrentProcess()->AppendSwitch( | 52 CommandLine::ForCurrentProcess()->AppendSwitch( |
52 extensions::switches::kEnableExperimentalExtensionApis); | 53 extensions::switches::kEnableExperimentalExtensionApis); |
53 | 54 |
54 ResultCatcher catcher; | 55 extensions::ResultCatcher catcher; |
55 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ | 56 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ |
56 .AppendASCII("window_open").AppendASCII("spanning"))); | 57 .AppendASCII("window_open").AppendASCII("spanning"))); |
57 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 58 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
58 } | 59 } |
59 | 60 |
60 int GetPanelCount(Browser* browser) { | 61 int GetPanelCount(Browser* browser) { |
61 #if defined(USE_ASH_PANELS) | 62 #if defined(USE_ASH_PANELS) |
62 return static_cast<int>(extensions::AppWindowRegistry::Get( | 63 return static_cast<int>(extensions::AppWindowRegistry::Get( |
63 browser->profile())->app_windows().size()); | 64 browser->profile())->app_windows().size()); |
64 #else | 65 #else |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 last_loaded_extension_id() + "/newtab.html"), | 504 last_loaded_extension_id() + "/newtab.html"), |
504 false, | 505 false, |
505 &newtab)); | 506 &newtab)); |
506 | 507 |
507 // Extension API should succeed. | 508 // Extension API should succeed. |
508 bool result = false; | 509 bool result = false; |
509 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", | 510 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", |
510 &result)); | 511 &result)); |
511 EXPECT_TRUE(result); | 512 EXPECT_TRUE(result); |
512 } | 513 } |
OLD | NEW |