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/platform_app_browsertest_util.h" | 5 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs.h" |
10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
11 #include "chrome/browser/extensions/shell_window_registry.h" | 11 #include "chrome/browser/extensions/shell_window_registry.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
14 #include "chrome/browser/ui/extensions/native_app_window.h" | 14 #include "chrome/browser/ui/extensions/native_app_window.h" |
15 #include "chrome/browser/ui/extensions/shell_window.h" | 15 #include "chrome/browser/ui/extensions/shell_window.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
19 | 19 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 app_registry->shell_windows(); | 86 app_registry->shell_windows(); |
87 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) { | 87 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) { |
88 return *iter; | 88 return *iter; |
89 } | 89 } |
90 | 90 |
91 return NULL; | 91 return NULL; |
92 } | 92 } |
93 | 93 |
94 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( | 94 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( |
95 const Extension* extension) { | 95 const Extension* extension) { |
96 scoped_refptr<WindowsGetAllFunction> function = new WindowsGetAllFunction(); | 96 scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction(); |
97 function->set_extension(extension); | 97 function->set_extension(extension); |
98 scoped_ptr<base::ListValue> result(utils::ToList( | 98 scoped_ptr<base::ListValue> result(utils::ToList( |
99 utils::RunFunctionAndReturnSingleResult(function.get(), | 99 utils::RunFunctionAndReturnSingleResult(function.get(), |
100 "[]", | 100 "[]", |
101 browser()))); | 101 browser()))); |
102 return result->GetSize(); | 102 return result->GetSize(); |
103 } | 103 } |
104 | 104 |
105 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( | 105 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( |
106 int window_id, | 106 int window_id, |
107 const Extension* extension) { | 107 const Extension* extension) { |
108 scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); | 108 scoped_refptr<GetWindowFunction> function = new GetWindowFunction(); |
109 function->set_extension(extension); | 109 function->set_extension(extension); |
110 utils::RunFunction( | 110 utils::RunFunction( |
111 function.get(), | 111 function.get(), |
112 base::StringPrintf("[%u]", window_id), | 112 base::StringPrintf("[%u]", window_id), |
113 browser(), | 113 browser(), |
114 utils::NONE); | 114 utils::NONE); |
115 return function->GetResultList() != NULL; | 115 return function->GetResultList() != NULL; |
116 } | 116 } |
117 | 117 |
118 size_t PlatformAppBrowserTest::GetShellWindowCount() { | 118 size_t PlatformAppBrowserTest::GetShellWindowCount() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 destroyed_observer.Wait(); | 152 destroyed_observer.Wait(); |
153 } | 153 } |
154 | 154 |
155 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 155 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
156 CommandLine* command_line) { | 156 CommandLine* command_line) { |
157 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 157 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
158 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 158 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
159 } | 159 } |
160 | 160 |
161 } // namespace extensions | 161 } // namespace extensions |
OLD | NEW |