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 21 matching lines...) Expand all Loading... | |
32 #include "net/test/spawned_test_server/spawned_test_server.h" | 32 #include "net/test/spawned_test_server/spawned_test_server.h" |
33 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
34 | 34 |
35 namespace extensions { | 35 namespace extensions { |
36 | 36 |
37 namespace keys = tabs_constants; | 37 namespace keys = tabs_constants; |
38 namespace utils = extension_function_test_utils; | 38 namespace utils = extension_function_test_utils; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 class ExtensionTabsTest : public InProcessBrowserTest { | 42 using ExtensionTabsTest = InProcessBrowserTest; |
43 }; | 43 using ExtensionWindowCreateTest = InProcessBrowserTest; |
44 | |
45 } | 44 } |
46 | 45 |
47 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { | 46 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { |
48 int window_id = ExtensionTabUtil::GetWindowId(browser()); | 47 int window_id = ExtensionTabUtil::GetWindowId(browser()); |
49 | 48 |
50 // Invalid window ID error. | 49 // Invalid window ID error. |
51 scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); | 50 scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); |
52 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); | 51 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); |
53 function->set_extension(extension.get()); | 52 function->set_extension(extension.get()); |
54 EXPECT_TRUE(MatchPattern( | 53 EXPECT_TRUE(MatchPattern( |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 function = new WindowsUpdateFunction(); | 553 function = new WindowsUpdateFunction(); |
555 function->set_extension(extension.get()); | 554 function->set_extension(extension.get()); |
556 EXPECT_TRUE(MatchPattern( | 555 EXPECT_TRUE(MatchPattern( |
557 utils::RunFunctionAndReturnError( | 556 utils::RunFunctionAndReturnError( |
558 function.get(), | 557 function.get(), |
559 base::StringPrintf(kArgsMaximizedWithBounds, window_id), | 558 base::StringPrintf(kArgsMaximizedWithBounds, window_id), |
560 browser()), | 559 browser()), |
561 keys::kInvalidWindowStateError)); | 560 keys::kInvalidWindowStateError)); |
562 } | 561 } |
563 | 562 |
563 IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, AcceptState) { | |
564 scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction()); | |
565 scoped_refptr<Extension> extension(test_util::CreateEmptyExtension()); | |
566 function->set_extension(extension.get()); | |
567 | |
568 scoped_ptr<base::DictionaryValue> result( | |
569 utils::ToDictionary(utils::RunFunctionAndReturnSingleResult( | |
570 function.get(), "[{\"state\": \"fullscreen\"}]", browser(), | |
571 utils::INCLUDE_INCOGNITO))); | |
572 int window_id = api_test_utils::GetInteger(result.get(), "id"); | |
573 std::string error; | |
574 Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID( | |
575 function.get(), window_id, &error); | |
576 EXPECT_TRUE(new_window->window()->IsFullscreen()); | |
not at google - send to devlin
2015/03/30 18:00:09
also test minimised
limasdf
2015/03/31 12:36:11
I cannot write minimized test for now.
Because, In
| |
577 } | |
578 | |
564 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) { | 579 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) { |
565 content::OpenURLParams params(GURL(url::kAboutBlankURL), | 580 content::OpenURLParams params(GURL(url::kAboutBlankURL), |
566 content::Referrer(), | 581 content::Referrer(), |
567 NEW_FOREGROUND_TAB, | 582 NEW_FOREGROUND_TAB, |
568 ui::PAGE_TRANSITION_LINK, | 583 ui::PAGE_TRANSITION_LINK, |
569 false); | 584 false); |
570 content::WebContents* web_contents = browser()->OpenURL(params); | 585 content::WebContents* web_contents = browser()->OpenURL(params); |
571 int tab_id = ExtensionTabUtil::GetTabId(web_contents); | 586 int tab_id = ExtensionTabUtil::GetTabId(web_contents); |
572 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents); | 587 int window_id = ExtensionTabUtil::GetWindowIdOfTab(web_contents); |
573 int tab_index = -1; | 588 int tab_index = -1; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 // Test chrome.tabs.setZoom(). | 1009 // Test chrome.tabs.setZoom(). |
995 error = RunSetZoomExpectError(tab_id, 3.14159); | 1010 error = RunSetZoomExpectError(tab_id, 3.14159); |
996 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1011 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
997 | 1012 |
998 // chrome.tabs.setZoomSettings(). | 1013 // chrome.tabs.setZoomSettings(). |
999 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); | 1014 error = RunSetZoomSettingsExpectError(tab_id, "manual", "per-tab"); |
1000 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); | 1015 EXPECT_TRUE(MatchPattern(error, manifest_errors::kCannotAccessChromeUrl)); |
1001 } | 1016 } |
1002 | 1017 |
1003 } // namespace extensions | 1018 } // namespace extensions |
OLD | NEW |