| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/prefs/incognito_mode_prefs.h" | 7 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.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/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "net/base/mock_host_resolver.h" | 13 #include "net/base/mock_host_resolver.h" |
| 14 | 14 |
| 15 // Possible race in ChromeURLDataManager. http://crbug.com/59198 | 15 // Possible race in ChromeURLDataManager. http://crbug.com/59198 |
| 16 #if defined(OS_MACOSX) || defined(OS_LINUX) | 16 #if defined(OS_MACOSX) || defined(OS_LINUX) |
| 17 #define MAYBE_TabOnRemoved DISABLED_TabOnRemoved | 17 #define MAYBE_TabOnRemoved DISABLED_TabOnRemoved |
| 18 #else | 18 #else |
| 19 #define MAYBE_TabOnRemoved TabOnRemoved | 19 #define MAYBE_TabOnRemoved TabOnRemoved |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 // Window resizes are not completed by the time the callback happens, | 22 // Window resizes are not completed by the time the callback happens, |
| 23 // so these tests fail on linux. http://crbug.com/72369 | 23 // so these tests fail on linux. http://crbug.com/72369 |
| 24 #if defined(OS_LINUX) | 24 #if defined(OS_LINUX) |
| 25 #define MAYBE_FocusWindowDoesNotExitFullscreen \ | 25 #define MAYBE_FocusWindowDoesNotExitFullscreen \ |
| 26 DISABLED_FocusWindowDoesNotExitFullscreen | 26 DISABLED_FocusWindowDoesNotExitFullscreen |
| 27 #define MAYBE_UpdateWindowSizeExitsFullscreen \ | 27 #define MAYBE_UpdateWindowSizeExitsFullscreen \ |
| 28 DISABLED_UpdateWindowSizeExitsFullscreen | 28 DISABLED_UpdateWindowSizeExitsFullscreen |
| 29 #define MAYBE_UpdateWindowShowState \ |
| 30 DISABLED_UpdateWindowShowState |
| 29 #else | 31 #else |
| 30 #define MAYBE_FocusWindowDoesNotExitFullscreen FocusWindowDoesNotExitFullscreen | 32 #define MAYBE_FocusWindowDoesNotExitFullscreen FocusWindowDoesNotExitFullscreen |
| 31 #define MAYBE_UpdateWindowSizeExitsFullscreen UpdateWindowSizeExitsFullscreen | 33 #define MAYBE_UpdateWindowSizeExitsFullscreen UpdateWindowSizeExitsFullscreen |
| 34 #define MAYBE_UpdateWindowShowState UpdateWindowShowState |
| 32 #endif | 35 #endif |
| 33 | 36 |
| 34 // In the touch build, this fails reliably. http://crbug.com/85191 | 37 // In the touch build, this fails reliably. http://crbug.com/85191 |
| 35 #if defined(TOUCH_UI) | 38 #if defined(TOUCH_UI) |
| 36 #define MAYBE_GetViewsOfCreatedWindow DISABLED_GetViewsOfCreatedWindow | 39 #define MAYBE_GetViewsOfCreatedWindow DISABLED_GetViewsOfCreatedWindow |
| 37 #else | 40 #else |
| 38 #define MAYBE_GetViewsOfCreatedWindow GetViewsOfCreatedWindow | 41 #define MAYBE_GetViewsOfCreatedWindow GetViewsOfCreatedWindow |
| 39 #endif | 42 #endif |
| 40 | 43 |
| 41 // In the touch build, this fails unreliably. http://crbug.com/85226 | 44 // In the touch build, this fails unreliably. http://crbug.com/85226 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 201 |
| 199 #if defined(OS_WIN) && !defined(USE_AURA) | 202 #if defined(OS_WIN) && !defined(USE_AURA) |
| 200 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FocusWindowDoesNotUnmaximize) { | 203 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FocusWindowDoesNotUnmaximize) { |
| 201 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); | 204 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); |
| 202 ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); | 205 ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); |
| 203 ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_; | 206 ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_; |
| 204 ASSERT_TRUE(::IsZoomed(window)); | 207 ASSERT_TRUE(::IsZoomed(window)); |
| 205 } | 208 } |
| 206 #endif // OS_WIN | 209 #endif // OS_WIN |
| 207 | 210 |
| 211 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_UpdateWindowShowState) { |
| 212 ASSERT_TRUE(RunExtensionTest("window_update/show_state")) << message_; |
| 213 } |
| 214 |
| 208 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledByPref) { | 215 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoDisabledByPref) { |
| 209 IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), | 216 IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), |
| 210 IncognitoModePrefs::DISABLED); | 217 IncognitoModePrefs::DISABLED); |
| 211 | 218 |
| 212 // This makes sure that creating an incognito window fails due to pref | 219 // This makes sure that creating an incognito window fails due to pref |
| 213 // (policy) being set. | 220 // (policy) being set. |
| 214 ASSERT_TRUE(RunExtensionTest("tabs/incognito_disabled")) << message_; | 221 ASSERT_TRUE(RunExtensionTest("tabs/incognito_disabled")) << message_; |
| 215 } | 222 } |
| 216 | 223 |
| 217 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViewsOfCreatedPopup) { | 224 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViewsOfCreatedPopup) { |
| 218 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_popup.html")) | 225 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_popup.html")) |
| 219 << message_; | 226 << message_; |
| 220 } | 227 } |
| 221 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViewsOfCreatedWindow) { | 228 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViewsOfCreatedWindow) { |
| 222 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) | 229 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) |
| 223 << message_; | 230 << message_; |
| 224 } | 231 } |
| 225 | 232 |
| 226 // Adding a new test? Awesome. But API tests are the old hotness. The | 233 // Adding a new test? Awesome. But API tests are the old hotness. The |
| 227 // new hotness is extension_test_utils. See extension_tabs_test.cc for | 234 // new hotness is extension_test_utils. See extension_tabs_test.cc for |
| 228 // an example. We are trying to phase out many uses of API tests as | 235 // an example. We are trying to phase out many uses of API tests as |
| 229 // they tend to be flaky. | 236 // they tend to be flaky. |
| OLD | NEW |