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 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2109 error = RunSetZoomExpectError(tab_id, 3.14159); | 2111 error = RunSetZoomExpectError(tab_id, 3.14159); |
2110 EXPECT_TRUE( | 2112 EXPECT_TRUE( |
2111 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2113 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
2112 | 2114 |
2113 // chrome.tabs.setZoomSettings(). | 2115 // chrome.tabs.setZoomSettings(). |
2114 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 2116 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
2115 EXPECT_TRUE( | 2117 EXPECT_TRUE( |
2116 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2118 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
2117 } | 2119 } |
2118 | 2120 |
2121 // Regression test for crbug.com/660498. | |
2122 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Foo) { | |
2123 ASSERT_TRUE(StartEmbeddedTestServer()); | |
2124 content::WebContents* first_web_contents = | |
2125 browser()->tab_strip_model()->GetActiveWebContents(); | |
2126 ASSERT_TRUE(first_web_contents); | |
2127 chrome::NewTab(browser()); | |
2128 content::WebContents* second_web_contents = | |
2129 browser()->tab_strip_model()->GetActiveWebContents(); | |
2130 ASSERT_NE(first_web_contents, second_web_contents); | |
2131 GURL url = embedded_test_server()->GetURL( | |
2132 "/extensions/api_test/tabs/pdf_extension_test.html"); | |
Charlie Reis
2016/11/11 23:26:07
Do you need to add this file? I don't see it in t
Devlin
2016/11/11 23:48:55
Whoops! Done.
| |
2133 content::TestNavigationManager navigation_manager( | |
2134 second_web_contents, GURL("http://www.facebook.com:83")); | |
2135 ui_test_utils::NavigateToURLWithDisposition( | |
2136 browser(), url, WindowOpenDisposition::CURRENT_TAB, | |
2137 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
2138 EXPECT_TRUE(navigation_manager.WaitForRequestStart()); | |
2139 | |
2140 browser()->tab_strip_model()->ActivateTabAt(0, true); | |
2141 EXPECT_EQ(first_web_contents, | |
2142 browser()->tab_strip_model()->GetActiveWebContents()); | |
2143 browser()->tab_strip_model()->ActivateTabAt(1, true); | |
2144 EXPECT_EQ(second_web_contents, | |
2145 browser()->tab_strip_model()->GetActiveWebContents()); | |
2146 | |
2147 EXPECT_EQ(url, second_web_contents->GetVisibleURL()); | |
2148 } | |
2149 | |
2119 } // namespace extensions | 2150 } // namespace extensions |
OLD | NEW |