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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/extensions/extension_host.h" | 6 #include "chrome/browser/extensions/extension_host.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
9 #include "chrome/browser/extensions/process_map.h" | 9 #include "chrome/browser/extensions/process_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 GURL GetTestBaseURL(std::string test_directory) { | 43 GURL GetTestBaseURL(std::string test_directory) { |
44 GURL::Replacements replace_host; | 44 GURL::Replacements replace_host; |
45 std::string host_str("localhost"); // must stay in scope with replace_host | 45 std::string host_str("localhost"); // must stay in scope with replace_host |
46 replace_host.SetHostStr(host_str); | 46 replace_host.SetHostStr(host_str); |
47 GURL base_url = test_server()->GetURL( | 47 GURL base_url = test_server()->GetURL( |
48 "files/extensions/api_test/" + test_directory + "/"); | 48 "files/extensions/api_test/" + test_directory + "/"); |
49 return base_url.ReplaceComponents(replace_host); | 49 return base_url.ReplaceComponents(replace_host); |
50 } | 50 } |
51 | 51 |
52 // Pass flags to make testing apps easier. | 52 // Pass flags to make testing apps easier. |
53 void SetUpCommandLine(CommandLine* command_line) { | 53 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
54 ExtensionApiTest::SetUpCommandLine(command_line); | 54 ExtensionApiTest::SetUpCommandLine(command_line); |
55 CommandLine::ForCurrentProcess()->AppendSwitch( | 55 CommandLine::ForCurrentProcess()->AppendSwitch( |
56 switches::kDisablePopupBlocking); | 56 switches::kDisablePopupBlocking); |
57 CommandLine::ForCurrentProcess()->AppendSwitch( | 57 CommandLine::ForCurrentProcess()->AppendSwitch( |
58 switches::kAllowHTTPBackgroundPage); | 58 switches::kAllowHTTPBackgroundPage); |
59 } | 59 } |
60 | 60 |
61 // Helper function to test that independent tabs of the named app are loaded | 61 // Helper function to test that independent tabs of the named app are loaded |
62 // into separate processes. | 62 // into separate processes. |
63 void TestAppInstancesHelper(std::string app_name) { | 63 void TestAppInstancesHelper(std::string app_name) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 OpenWindow(tab1, base_url.Resolve("path1/empty.html"), true, NULL); | 117 OpenWindow(tab1, base_url.Resolve("path1/empty.html"), true, NULL); |
118 LOG(INFO) << "WindowOpenHelper 1."; | 118 LOG(INFO) << "WindowOpenHelper 1."; |
119 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL); | 119 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL); |
120 LOG(INFO) << "End of test."; | 120 LOG(INFO) << "End of test."; |
121 } | 121 } |
122 }; | 122 }; |
123 | 123 |
124 // Omits the disable-popup-blocking flag so we can cover that case. | 124 // Omits the disable-popup-blocking flag so we can cover that case. |
125 class BlockedAppApiTest : public AppApiTest { | 125 class BlockedAppApiTest : public AppApiTest { |
126 protected: | 126 protected: |
127 void SetUpCommandLine(CommandLine* command_line) { | 127 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
128 ExtensionApiTest::SetUpCommandLine(command_line); | 128 ExtensionApiTest::SetUpCommandLine(command_line); |
129 CommandLine::ForCurrentProcess()->AppendSwitch( | 129 CommandLine::ForCurrentProcess()->AppendSwitch( |
130 switches::kAllowHTTPBackgroundPage); | 130 switches::kAllowHTTPBackgroundPage); |
131 } | 131 } |
132 }; | 132 }; |
133 | 133 |
134 // Tests that hosted apps with the background permission get a process-per-app | 134 // Tests that hosted apps with the background permission get a process-per-app |
135 // model, since all pages need to be able to script the background page. | 135 // model, since all pages need to be able to script the background page. |
136 // http://crbug.com/172750 | 136 // http://crbug.com/172750 |
137 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 &browser()->tab_strip_model()->GetActiveWebContents()-> | 669 &browser()->tab_strip_model()->GetActiveWebContents()-> |
670 GetController())); | 670 GetController())); |
671 chrome::Reload(browser(), CURRENT_TAB); | 671 chrome::Reload(browser(), CURRENT_TAB); |
672 observer.Wait(); | 672 observer.Wait(); |
673 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 673 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
674 contents, | 674 contents, |
675 "window.domAutomationController.send(chrome.app.isInstalled)", | 675 "window.domAutomationController.send(chrome.app.isInstalled)", |
676 &is_installed)); | 676 &is_installed)); |
677 ASSERT_TRUE(is_installed); | 677 ASSERT_TRUE(is_installed); |
678 } | 678 } |
OLD | NEW |