| 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 35 #include "chrome/browser/ui/views/frame/browser_view.h" | 35 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 36 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 36 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
| 38 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
| 39 #include "content/public/browser/browser_context.h" | 39 #include "content/public/browser/browser_context.h" |
| 40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/storage_partition.h" | 41 #include "content/public/browser/storage_partition.h" |
| 42 #include "content/public/common/page_zoom.h" | 42 #include "content/public/common/page_zoom.h" |
| 43 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
| 44 #include "content/public/test/browser_test_utils.h" |
| 44 #include "extensions/browser/api_test_utils.h" | 45 #include "extensions/browser/api_test_utils.h" |
| 45 #include "extensions/browser/app_window/app_window.h" | 46 #include "extensions/browser/app_window/app_window.h" |
| 46 #include "extensions/browser/app_window/app_window_registry.h" | 47 #include "extensions/browser/app_window/app_window_registry.h" |
| 47 #include "extensions/browser/app_window/native_app_window.h" | 48 #include "extensions/browser/app_window/native_app_window.h" |
| 48 #include "extensions/common/manifest_constants.h" | 49 #include "extensions/common/manifest_constants.h" |
| 49 #include "extensions/common/test_util.h" | 50 #include "extensions/common/test_util.h" |
| 50 #include "extensions/test/extension_test_message_listener.h" | 51 #include "extensions/test/extension_test_message_listener.h" |
| 51 #include "extensions/test/result_catcher.h" | 52 #include "extensions/test/result_catcher.h" |
| 52 #include "net/test/embedded_test_server/embedded_test_server.h" | 53 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 54 #include "ui/base/window_open_disposition.h" |
| 53 #include "ui/gfx/geometry/rect.h" | 55 #include "ui/gfx/geometry/rect.h" |
| 54 #include "ui/views/widget/widget.h" | 56 #include "ui/views/widget/widget.h" |
| 55 #include "ui/views/widget/widget_observer.h" | 57 #include "ui/views/widget/widget_observer.h" |
| 56 | 58 |
| 57 #if defined(OS_MACOSX) | 59 #if defined(OS_MACOSX) |
| 58 #include "base/mac/mac_util.h" | 60 #include "base/mac/mac_util.h" |
| 59 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h" | 61 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h" |
| 60 #endif | 62 #endif |
| 61 | 63 |
| 62 namespace extensions { | 64 namespace extensions { |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 error = RunSetZoomExpectError(tab_id, 3.14159); | 2109 error = RunSetZoomExpectError(tab_id, 3.14159); |
| 2108 EXPECT_TRUE( | 2110 EXPECT_TRUE( |
| 2109 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2111 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 2110 | 2112 |
| 2111 // chrome.tabs.setZoomSettings(). | 2113 // chrome.tabs.setZoomSettings(). |
| 2112 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 2114 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
| 2113 EXPECT_TRUE( | 2115 EXPECT_TRUE( |
| 2114 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2116 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 2115 } | 2117 } |
| 2116 | 2118 |
| 2119 // Regression test for crbug.com/660498. |
| 2120 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Foo) { |
| 2121 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 2122 content::WebContents* first_web_contents = |
| 2123 browser()->tab_strip_model()->GetActiveWebContents(); |
| 2124 ASSERT_TRUE(first_web_contents); |
| 2125 chrome::NewTab(browser()); |
| 2126 content::WebContents* second_web_contents = |
| 2127 browser()->tab_strip_model()->GetActiveWebContents(); |
| 2128 ASSERT_NE(first_web_contents, second_web_contents); |
| 2129 GURL url = embedded_test_server()->GetURL( |
| 2130 "/extensions/api_test/tabs/pdf_extension_test.html"); |
| 2131 content::TestNavigationManager navigation_manager( |
| 2132 second_web_contents, GURL("http://www.facebook.com:83")); |
| 2133 ui_test_utils::NavigateToURLWithDisposition( |
| 2134 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
| 2135 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 2136 EXPECT_TRUE(navigation_manager.WaitForRequestStart()); |
| 2137 |
| 2138 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 2139 EXPECT_EQ(first_web_contents, |
| 2140 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2141 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 2142 EXPECT_EQ(second_web_contents, |
| 2143 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2144 |
| 2145 EXPECT_EQ(url, second_web_contents->GetVisibleURL()); |
| 2146 } |
| 2147 |
| 2117 } // namespace extensions | 2148 } // namespace extensions |
| OLD | NEW |