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

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: minimized test Created 5 years, 9 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
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 38309a6a13404ec1b909ac5565e8a24fb4b30bcc..663f4c2a63315f21bf53f31d733f04b583024bb7 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -39,9 +39,8 @@ namespace utils = extension_function_test_utils;
namespace {
-class ExtensionTabsTest : public InProcessBrowserTest {
-};
-
+using ExtensionTabsTest = InProcessBrowserTest;
+using ExtensionWindowCreateTest = InProcessBrowserTest;
}
IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) {
@@ -561,6 +560,36 @@ 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());
tapted 2015/04/01 03:41:55 EXPECT_TRUE(error.empty()) ?
limasdf 2015/04/15 23:34:49 Done.
+
+ 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);
tapted 2015/04/01 03:41:55 same here, immediately after this line. Perhaps a
limasdf 2015/04/15 23:34:49 Done for |error|. `EXPECT_TRUE(new_window);` is no
+#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(),

Powered by Google App Engine
This is Rietveld 408576698