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 | 5 |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 keys::kInvalidWindowStateError)); | 573 keys::kInvalidWindowStateError)); |
574 } | 574 } |
575 | 575 |
576 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, AcceptState) { | 576 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, AcceptState) { |
577 scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction()); | 577 scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction()); |
578 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); | 578 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); |
579 function->set_extension(extension.get()); | 579 function->set_extension(extension.get()); |
580 | 580 |
581 scoped_ptr<base::DictionaryValue> result( | 581 scoped_ptr<base::DictionaryValue> result( |
582 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | 582 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
583 function.get(), "[{\"state\": \"fullscreen\"}]", browser(), | 583 function.get(), "[{\"state\": \"minimized\"}]", browser(), |
584 utils::INCLUDE_INCOGNITO))); | 584 utils::INCLUDE_INCOGNITO))); |
585 int window_id = api_test_utils::GetInteger(result.get(), "id"); | 585 int window_id = api_test_utils::GetInteger(result.get(), "id"); |
586 std::string error; | 586 std::string error; |
587 Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID( | 587 Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID( |
588 function.get(), window_id, &error); | 588 function.get(), window_id, &error); |
589 EXPECT_TRUE(new_window->window()->IsFullscreen()); | |
590 EXPECT_TRUE(error.empty()); | |
591 | |
592 function = new WindowsCreateFunction(); | |
593 function->set_extension(extension.get()); | |
594 result.reset(utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | |
595 function.get(), "[{\"state\": \"minimized\"}]", browser(), | |
596 utils::INCLUDE_INCOGNITO))); | |
597 window_id = api_test_utils::GetInteger(result.get(), "id"); | |
598 new_window = ExtensionTabUtil::GetBrowserFromWindowID(function.get(), | |
599 window_id, &error); | |
600 EXPECT_TRUE(error.empty()); | 589 EXPECT_TRUE(error.empty()); |
601 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) | 590 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) |
602 // DesktopWindowTreeHostX11::IsMinimized() relies on an asynchronous update | 591 // DesktopWindowTreeHostX11::IsMinimized() relies on an asynchronous update |
603 // from the window server. | 592 // from the window server. |
604 EXPECT_TRUE(new_window->window()->IsMinimized()); | 593 EXPECT_TRUE(new_window->window()->IsMinimized()); |
605 #endif | 594 #endif |
| 595 |
| 596 // TODO(limasdf): Flaky on mac. See http://crbug.com/482433. |
| 597 #if !defined(OS_MACOSX) |
| 598 function = new WindowsCreateFunction(); |
| 599 function->set_extension(extension.get()); |
| 600 result.reset(utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( |
| 601 function.get(), "[{\"state\": \"fullscreen\"}]", browser(), |
| 602 utils::INCLUDE_INCOGNITO))); |
| 603 window_id = api_test_utils::GetInteger(result.get(), "id"); |
| 604 new_window = ExtensionTabUtil::GetBrowserFromWindowID(function.get(), |
| 605 window_id, &error); |
| 606 EXPECT_TRUE(error.empty()); |
| 607 EXPECT_TRUE(new_window->window()->IsFullscreen()); |
| 608 #endif // !defined(OS_MACOSX) |
606 } | 609 } |
607 | 610 |
608 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, ValidateCreateWindowState) { | 611 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, ValidateCreateWindowState) { |
609 EXPECT_TRUE( | 612 EXPECT_TRUE( |
610 MatchPattern(RunCreateWindowExpectError( | 613 MatchPattern(RunCreateWindowExpectError( |
611 "[{\"state\": \"fullscreen\", \"type\": \"panel\"}]"), | 614 "[{\"state\": \"fullscreen\", \"type\": \"panel\"}]"), |
612 keys::kInvalidWindowStateError)); | 615 keys::kInvalidWindowStateError)); |
613 EXPECT_TRUE( | 616 EXPECT_TRUE( |
614 MatchPattern(RunCreateWindowExpectError( | 617 MatchPattern(RunCreateWindowExpectError( |
615 "[{\"state\": \"maximized\", \"type\": \"panel\"}]"), | 618 "[{\"state\": \"maximized\", \"type\": \"panel\"}]"), |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 // Test chrome.tabs.setZoom(). | 1165 // Test chrome.tabs.setZoom(). |
1163 error = RunSetZoomExpectError(tab_id, 3.14159); | 1166 error = RunSetZoomExpectError(tab_id, 3.14159); |
1164 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1167 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
1165 | 1168 |
1166 // chrome.tabs.setZoomSettings(). | 1169 // chrome.tabs.setZoomSettings(). |
1167 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 1170 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
1168 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1171 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
1169 } | 1172 } |
1170 | 1173 |
1171 } // namespace extensions | 1174 } // namespace extensions |
OLD | NEW |