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

Side by Side Diff: chrome/browser/extensions/extension_tabs_test.cc

Issue 9968078: Honor window size for chrome.windows.create when parent window is maximized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous logging Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // TODO(aa): Can't assume window is focused. On mac, calling Activate() from a 77 // TODO(aa): Can't assume window is focused. On mac, calling Activate() from a
78 // browser test doesn't seem to do anything, so can't test the opposite 78 // browser test doesn't seem to do anything, so can't test the opposite
79 // either. 79 // either.
80 EXPECT_EQ(browser()->window()->IsActive(), 80 EXPECT_EQ(browser()->window()->IsActive(),
81 utils::GetBoolean(result.get(), "focused")); 81 utils::GetBoolean(result.get(), "focused"));
82 82
83 // TODO(aa): Minimized and maximized dimensions. Is there a way to set 83 // TODO(aa): Minimized and maximized dimensions. Is there a way to set
84 // minimize/maximize programmatically? 84 // minimize/maximize programmatically?
85 85
86 // Popup. 86 // Popup.
87 Browser* popup_browser = 87 Browser* popup_browser = Browser::CreateWithParams(
88 Browser::CreateForType(Browser::TYPE_POPUP, browser()->profile()); 88 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile()));
89 result.reset(utils::ToDictionary( 89 result.reset(utils::ToDictionary(
90 utils::RunFunctionAndReturnResult( 90 utils::RunFunctionAndReturnResult(
91 new GetWindowFunction(), 91 new GetWindowFunction(),
92 base::StringPrintf( 92 base::StringPrintf(
93 "[%u]", ExtensionTabUtil::GetWindowId(popup_browser)), 93 "[%u]", ExtensionTabUtil::GetWindowId(popup_browser)),
94 browser()))); 94 browser())));
95 EXPECT_EQ("popup", utils::GetString(result.get(), "type")); 95 EXPECT_EQ("popup", utils::GetString(result.get(), "type"));
96 96
97 // Panel. 97 // Panel.
98 Browser* panel_browser = 98 Browser* panel_browser = Browser::CreateWithParams(
99 Browser::CreateForType(Browser::TYPE_PANEL, browser()->profile()); 99 Browser::CreateParams(Browser::TYPE_PANEL, browser()->profile()));
100 result.reset(utils::ToDictionary( 100 result.reset(utils::ToDictionary(
101 utils::RunFunctionAndReturnResult( 101 utils::RunFunctionAndReturnResult(
102 new GetWindowFunction(), 102 new GetWindowFunction(),
103 base::StringPrintf( 103 base::StringPrintf(
104 "[%u]", ExtensionTabUtil::GetWindowId(panel_browser)), 104 "[%u]", ExtensionTabUtil::GetWindowId(panel_browser)),
105 browser()))); 105 browser())));
106 EXPECT_EQ("panel", utils::GetString(result.get(), "type")); 106 EXPECT_EQ("panel", utils::GetString(result.get(), "type"));
107 107
108 // Incognito. 108 // Incognito.
109 Browser* incognito_browser = CreateIncognitoBrowser(); 109 Browser* incognito_browser = CreateIncognitoBrowser();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab)); 469 EXPECT_TRUE(result_tabs->GetDictionary(i, &result_tab));
470 EXPECT_NE(focused_window_id, utils::GetInteger(result_tab, 470 EXPECT_NE(focused_window_id, utils::GetInteger(result_tab,
471 keys::kWindowIdKey)); 471 keys::kWindowIdKey));
472 } 472 }
473 } 473 }
474 474
475 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) { 475 IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) {
476 // Test creates new popup window, closes it right away and then tries to open 476 // Test creates new popup window, closes it right away and then tries to open
477 // a new tab in it. Tab should not be opened in the popup window, but in a 477 // a new tab in it. Tab should not be opened in the popup window, but in a
478 // tabbed browser window. 478 // tabbed browser window.
479 Browser* popup_browser = 479 Browser* popup_browser = Browser::CreateWithParams(
480 Browser::CreateForType(Browser::TYPE_POPUP, browser()->profile()); 480 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile()));
481 int window_id = ExtensionTabUtil::GetWindowId(popup_browser); 481 int window_id = ExtensionTabUtil::GetWindowId(popup_browser);
482 popup_browser->CloseWindow(); 482 popup_browser->CloseWindow();
483 483
484 scoped_refptr<CreateTabFunction> create_tab_function(new CreateTabFunction()); 484 scoped_refptr<CreateTabFunction> create_tab_function(new CreateTabFunction());
485 // Without a callback the function will not generate a result. 485 // Without a callback the function will not generate a result.
486 create_tab_function->set_has_callback(true); 486 create_tab_function->set_has_callback(true);
487 487
488 static const char kNewBlankTabArgs[] = 488 static const char kNewBlankTabArgs[] =
489 "[{\"url\": \"about:blank\", \"windowId\": %u}]"; 489 "[{\"url\": \"about:blank\", \"windowId\": %u}]";
490 490
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 static const char kArgsMaximizedWithBounds[] = 530 static const char kArgsMaximizedWithBounds[] =
531 "[%u, {\"state\": \"maximized\", \"width\": 500}]"; 531 "[%u, {\"state\": \"maximized\", \"width\": 500}]";
532 EXPECT_TRUE(MatchPattern( 532 EXPECT_TRUE(MatchPattern(
533 utils::RunFunctionAndReturnError( 533 utils::RunFunctionAndReturnError(
534 new UpdateWindowFunction(), 534 new UpdateWindowFunction(),
535 base::StringPrintf(kArgsMaximizedWithBounds, window_id), 535 base::StringPrintf(kArgsMaximizedWithBounds, window_id),
536 browser()), 536 browser()),
537 keys::kInvalidWindowStateError)); 537 keys::kInvalidWindowStateError));
538 } 538 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698