Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5058)

Unified Diff: chrome/browser/extensions/api/tabs/tabs_test.cc

Issue 1015123003: Extension window.create API accepts state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grammer Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/common/extensions/api/windows.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tabs/tabs_test.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index f2f3aa3ca189f54cc7d5f1ae3c4c136785bb9d45..101adbf31e5e0f47934cf4c318d0d19ff2739c6a 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -41,10 +41,8 @@ namespace keys = tabs_constants;
namespace utils = extension_function_test_utils;
namespace {
-
-class ExtensionTabsTest : public InProcessBrowserTest {
-};
-
+using ExtensionTabsTest = InProcessBrowserTest;
+using ExtensionWindowCreateTest = InProcessBrowserTest;
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) {
@@ -564,6 +562,38 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) {
keys::kInvalidWindowStateError));
}
+IN_PROC_BROWSER_TEST_F(ExtensionWindowCreateTest, AcceptState) {
+ scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction());
+ scoped_refptr<Extension> extension(test_util::CreateEmptyExtension());
+ function->set_extension(extension.get());
+
+ scoped_ptr<base::DictionaryValue> result(
+ utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[{\"state\": \"fullscreen\"}]", browser(),
+ utils::INCLUDE_INCOGNITO)));
+ int window_id = api_test_utils::GetInteger(result.get(), "id");
+ std::string error;
+ Browser* new_window = ExtensionTabUtil::GetBrowserFromWindowID(
+ function.get(), window_id, &error);
+ EXPECT_TRUE(new_window->window()->IsFullscreen());
+ EXPECT_TRUE(error.empty());
+
+ function = new WindowsCreateFunction();
+ function->set_extension(extension.get());
+ result.reset(utils::ToDictionary(utils::RunFunctionAndReturnSingleResult(
+ function.get(), "[{\"state\": \"minimized\"}]", browser(),
+ utils::INCLUDE_INCOGNITO)));
+ window_id = api_test_utils::GetInteger(result.get(), "id");
+ new_window = ExtensionTabUtil::GetBrowserFromWindowID(function.get(),
+ window_id, &error);
+ EXPECT_TRUE(error.empty());
+#if !defined(OS_LINUX) || defined(OS_CHROMEOS)
+ // DesktopWindowTreeHostX11::IsMinimized() relies on an asynchronous update
+ // from the window server.
+ EXPECT_TRUE(new_window->window()->IsMinimized());
+#endif
+}
+
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) {
content::OpenURLParams params(GURL(url::kAboutBlankURL),
content::Referrer(),
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/common/extensions/api/windows.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698