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 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 8 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "net/dns/mock_host_resolver.h" | 15 #include "net/dns/mock_host_resolver.h" |
16 | 16 |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
20 #endif | 20 #endif |
21 | 21 |
22 // Window resizes are not completed by the time the callback happens, | |
23 // so these tests fail on linux/gtk. http://crbug.com/72369 | |
24 #if defined(OS_LINUX) && !defined(USE_AURA) | |
25 #define MAYBE_UpdateWindowResize DISABLED_UpdateWindowResize | |
26 #define MAYBE_UpdateWindowShowState DISABLED_UpdateWindowShowState | |
27 #else | |
28 | |
29 #if defined(USE_AURA) || defined(OS_MACOSX) | 22 #if defined(USE_AURA) || defined(OS_MACOSX) |
30 // Maximizing/fullscreen popup window doesn't work on aura's managed mode. | 23 // Maximizing/fullscreen popup window doesn't work on aura's managed mode. |
31 // See bug crbug.com/116305. | 24 // See bug crbug.com/116305. |
32 // Mac: http://crbug.com/103912 | 25 // Mac: http://crbug.com/103912 |
33 #define MAYBE_UpdateWindowShowState DISABLED_UpdateWindowShowState | 26 #define MAYBE_UpdateWindowShowState DISABLED_UpdateWindowShowState |
34 #else | 27 #else |
35 #define MAYBE_UpdateWindowShowState UpdateWindowShowState | 28 #define MAYBE_UpdateWindowShowState UpdateWindowShowState |
36 #endif // defined(USE_AURA) || defined(OS_MACOSX) | 29 #endif // defined(USE_AURA) || defined(OS_MACOSX) |
37 | 30 |
38 #define MAYBE_UpdateWindowResize UpdateWindowResize | |
39 #endif // defined(OS_LINUX) && !defined(USE_AURA) | |
40 | |
41 // http://crbug.com/145639 | 31 // http://crbug.com/145639 |
42 #if defined(OS_LINUX) || defined(OS_WIN) | 32 #if defined(OS_LINUX) || defined(OS_WIN) |
43 #define MAYBE_TabEvents DISABLED_TabEvents | 33 #define MAYBE_TabEvents DISABLED_TabEvents |
44 #else | 34 #else |
45 #define MAYBE_TabEvents TabEvents | 35 #define MAYBE_TabEvents TabEvents |
46 #endif | 36 #endif |
47 | 37 |
48 class ExtensionApiNewTabTest : public ExtensionApiTest { | 38 class ExtensionApiNewTabTest : public ExtensionApiTest { |
49 public: | 39 public: |
50 ExtensionApiNewTabTest() {} | 40 ExtensionApiNewTabTest() {} |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 205 } |
216 | 206 |
217 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabsOnUpdated) { | 207 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabsOnUpdated) { |
218 ASSERT_TRUE(RunExtensionTest("tabs/on_updated")) << message_; | 208 ASSERT_TRUE(RunExtensionTest("tabs/on_updated")) << message_; |
219 } | 209 } |
220 | 210 |
221 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabsNoPermissions) { | 211 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabsNoPermissions) { |
222 ASSERT_TRUE(RunExtensionTest("tabs/no_permissions")) << message_; | 212 ASSERT_TRUE(RunExtensionTest("tabs/no_permissions")) << message_; |
223 } | 213 } |
224 | 214 |
225 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, | 215 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, UpdateWindowResize) { |
226 MAYBE_UpdateWindowResize) { | |
227 ASSERT_TRUE(RunExtensionTest("window_update/resize")) << message_; | 216 ASSERT_TRUE(RunExtensionTest("window_update/resize")) << message_; |
228 } | 217 } |
229 | 218 |
230 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
231 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FocusWindowDoesNotUnmaximize) { | 220 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FocusWindowDoesNotUnmaximize) { |
232 HWND window = | 221 HWND window = |
233 browser()->window()->GetNativeWindow()->GetHost()->GetAcceleratedWidget(); | 222 browser()->window()->GetNativeWindow()->GetHost()->GetAcceleratedWidget(); |
234 ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); | 223 ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); |
235 ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_; | 224 ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_; |
236 ASSERT_TRUE(::IsZoomed(window)); | 225 ASSERT_TRUE(::IsZoomed(window)); |
(...skipping 18 matching lines...) Expand all Loading... |
255 << message_; | 244 << message_; |
256 } | 245 } |
257 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_GetViewsOfCreatedWindow) { | 246 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_GetViewsOfCreatedWindow) { |
258 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) | 247 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) |
259 << message_; | 248 << message_; |
260 } | 249 } |
261 | 250 |
262 // Adding a new test? Awesome. But API tests are the old hotness. The | 251 // Adding a new test? Awesome. But API tests are the old hotness. The |
263 // new hotness is extension_test_utils. See tabs_test.cc for an example. | 252 // new hotness is extension_test_utils. See tabs_test.cc for an example. |
264 // We are trying to phase out many uses of API tests as they tend to be flaky. | 253 // We are trying to phase out many uses of API tests as they tend to be flaky. |
OLD | NEW |