| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 int GetWindowId(base::DictionaryValue* window) { | 94 int GetWindowId(base::DictionaryValue* window) { |
| 95 int id = kUndefinedId; | 95 int id = kUndefinedId; |
| 96 if (window) | 96 if (window) |
| 97 window->GetInteger(keys::kIdKey, &id); | 97 window->GetInteger(keys::kIdKey, &id); |
| 98 return id; | 98 return id; |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| 102 | 102 |
| 103 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { | 103 #if defined(OS_WIN) |
| 104 // Crashes under Dr. Memory, see https://crbug.com/605880. |
| 105 #define MAYBE_GetWindow DISABLED_GetWindow |
| 106 #else |
| 107 #define MAYBE_GetWindow GetWindow |
| 108 #endif |
| 109 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_GetWindow) { |
| 104 int window_id = ExtensionTabUtil::GetWindowId(browser()); | 110 int window_id = ExtensionTabUtil::GetWindowId(browser()); |
| 105 | 111 |
| 106 // Invalid window ID error. | 112 // Invalid window ID error. |
| 107 scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); | 113 scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); |
| 108 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); | 114 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); |
| 109 function->set_extension(extension.get()); | 115 function->set_extension(extension.get()); |
| 110 EXPECT_TRUE(base::MatchPattern( | 116 EXPECT_TRUE(base::MatchPattern( |
| 111 utils::RunFunctionAndReturnError( | 117 utils::RunFunctionAndReturnError( |
| 112 function.get(), base::StringPrintf("[%u]", window_id + 1), browser()), | 118 function.get(), base::StringPrintf("[%u]", window_id + 1), browser()), |
| 113 keys::kWindowNotFoundError)); | 119 keys::kWindowNotFoundError)); |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 EXPECT_TRUE( | 1738 EXPECT_TRUE( |
| 1733 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1739 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 1734 | 1740 |
| 1735 // chrome.tabs.setZoomSettings(). | 1741 // chrome.tabs.setZoomSettings(). |
| 1736 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 1742 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
| 1737 EXPECT_TRUE( | 1743 EXPECT_TRUE( |
| 1738 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1744 base::MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
| 1739 } | 1745 } |
| 1740 | 1746 |
| 1741 } // namespace extensions | 1747 } // namespace extensions |
| OLD | NEW |