| 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); | 1064 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); |
| 1065 function->set_extension(extension.get()); | 1065 function->set_extension(extension.get()); |
| 1066 | 1066 |
| 1067 std::unique_ptr<base::DictionaryValue> result( | 1067 std::unique_ptr<base::DictionaryValue> result( |
| 1068 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | 1068 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
| 1069 function.get(), "[{\"state\": \"minimized\"}]", browser(), | 1069 function.get(), "[{\"state\": \"minimized\"}]", browser(), |
| 1070 utils::INCLUDE_INCOGNITO))); | 1070 utils::INCLUDE_INCOGNITO))); |
| 1071 int window_id = GetWindowId(result.get()); | 1071 int window_id = GetWindowId(result.get()); |
| 1072 std::string error; | 1072 std::string error; |
| 1073 Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID( | 1073 Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID( |
| 1074 function.get(), window_id, &error); | 1074 ChromeExtensionFunctionDetails(function.get()), window_id, &error); |
| 1075 EXPECT_TRUE(error.empty()); | 1075 EXPECT_TRUE(error.empty()); |
| 1076 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) | 1076 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 1077 // DesktopWindowTreeHostX11::IsMinimized() relies on an asynchronous update | 1077 // DesktopWindowTreeHostX11::IsMinimized() relies on an asynchronous update |
| 1078 // from the window server. | 1078 // from the window server. |
| 1079 EXPECT_TRUE(new_window->window()->IsMinimized()); | 1079 EXPECT_TRUE(new_window->window()->IsMinimized()); |
| 1080 #endif | 1080 #endif |
| 1081 | 1081 |
| 1082 function = new WindowsCreateFunction(); | 1082 function = new WindowsCreateFunction(); |
| 1083 function->set_extension(extension.get()); | 1083 function->set_extension(extension.get()); |
| 1084 result.reset(utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | 1084 result.reset(utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
| 1085 function.get(), "[{\"state\": \"fullscreen\"}]", browser(), | 1085 function.get(), "[{\"state\": \"fullscreen\"}]", browser(), |
| 1086 utils::INCLUDE_INCOGNITO))); | 1086 utils::INCLUDE_INCOGNITO))); |
| 1087 window_id = GetWindowId(result.get()); | 1087 window_id = GetWindowId(result.get()); |
| 1088 new_window = ExtensionTabUtil::GetBrowserFromWindowID(function.get(), | 1088 new_window = ExtensionTabUtil::GetBrowserFromWindowID( |
| 1089 window_id, &error); | 1089 ChromeExtensionFunctionDetails(function.get()), window_id, &error); |
| 1090 EXPECT_TRUE(error.empty()); | 1090 EXPECT_TRUE(error.empty()); |
| 1091 EXPECT_TRUE(new_window->window()->IsFullscreen()); | 1091 EXPECT_TRUE(new_window->window()->IsFullscreen()); |
| 1092 | 1092 |
| 1093 // Let the message loop run so that |fake_fullscreen| finishes transition. | 1093 // Let the message loop run so that |fake_fullscreen| finishes transition. |
| 1094 content::RunAllPendingInMessageLoop(); | 1094 content::RunAllPendingInMessageLoop(); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, ValidateCreateWindowState) { | 1097 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, ValidateCreateWindowState) { |
| 1098 EXPECT_TRUE(base::MatchPattern( | 1098 EXPECT_TRUE(base::MatchPattern( |
| 1099 RunCreateWindowExpectError( | 1099 RunCreateWindowExpectError( |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 EXPECT_TRUE( | 2108 EXPECT_TRUE( |
| 2109 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2109 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 2110 | 2110 |
| 2111 // chrome.tabs.setZoomSettings(). | 2111 // chrome.tabs.setZoomSettings(). |
| 2112 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 2112 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
| 2113 EXPECT_TRUE( | 2113 EXPECT_TRUE( |
| 2114 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 2114 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 2115 } | 2115 } |
| 2116 | 2116 |
| 2117 } // namespace extensions | 2117 } // namespace extensions |
| OLD | NEW |