Commit 91793ffa authored by alicet@chromium.org's avatar alicet@chromium.org

Check that we have a focus manager in aura before trying to set focus.

This allows PrintPreviewUITest to run under aura also.

BUG=104284
TEST=ran unit_tests and ui_tests with use_aura=1 chromeos=1


Review URL: http://codereview.chromium.org/8659014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113362 0039d316-1c4b-4281-b951-d872f2087c98
parent a5c360af
...@@ -113,7 +113,7 @@ void NativeTabContentsContainerAura::RequestFocus() { ...@@ -113,7 +113,7 @@ void NativeTabContentsContainerAura::RequestFocus() {
// that should also have focus, RequestFocus() is invoked one the // that should also have focus, RequestFocus() is invoked one the
// TabContentsContainer. In order to make sure OnFocus() is invoked we need // TabContentsContainer. In order to make sure OnFocus() is invoked we need
// to clear the focus before hands. // to clear the focus before hands.
{ if (GetFocusManager()) {
// Disable notifications. Clear focus will assign the focus to the main // Disable notifications. Clear focus will assign the focus to the main
// browser window. Because this change of focus was not user requested, // browser window. Because this change of focus was not user requested,
// don't send it to listeners. // don't send it to listeners.
......
...@@ -18,25 +18,6 @@ ...@@ -18,25 +18,6 @@
#include "printing/page_size_margins.h" #include "printing/page_size_margins.h"
#include "printing/print_job_constants.h" #include "printing/print_job_constants.h"
// Test crashes on Aura due to initiator tab's native view having no parent.
// http://crbug.com/104284
#if defined(USE_AURA)
#define MAYBE_StickyMarginsCustom DISABLED_StickyMarginsCustom
#define MAYBE_StickyMarginsDefault DISABLED_StickyMarginsDefault
#define MAYBE_StickyMarginsCustomThenDefault \
DISABLED_StickyMarginsCustomThenDefault
#define MAYBE_GetLastUsedMarginSettingsCustom \
DISABLED_GetLastUsedMarginSettingsCustom
#define MAYBE_GetLastUsedMarginSettingsDefault \
DISABLED_GetLastUsedMarginSettingsDefault
#else
#define MAYBE_StickyMarginsCustom StickyMarginsCustom
#define MAYBE_StickyMarginsDefault StickyMarginsDefault
#define MAYBE_StickyMarginsCustomThenDefault StickyMarginsCustomThenDefault
#define MAYBE_GetLastUsedMarginSettingsCustom GetLastUsedMarginSettingsCustom
#define MAYBE_GetLastUsedMarginSettingsDefault GetLastUsedMarginSettingsDefault
#endif
namespace { namespace {
DictionaryValue* GetCustomMarginsDictionary( DictionaryValue* GetCustomMarginsDictionary(
...@@ -170,7 +151,7 @@ class PrintPreviewHandlerTest : public BrowserWithTestWindowTest { ...@@ -170,7 +151,7 @@ class PrintPreviewHandlerTest : public BrowserWithTestWindowTest {
// Tests that margin settings are saved correctly when printing with custom // Tests that margin settings are saved correctly when printing with custom
// margins selected. // margins selected.
TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustom) { TEST_F(PrintPreviewHandlerTest, StickyMarginsCustom) {
const double kMarginTop = 25.5; const double kMarginTop = 25.5;
const double kMarginRight = 26.5; const double kMarginRight = 26.5;
const double kMarginBottom = 27.5; const double kMarginBottom = 27.5;
...@@ -189,7 +170,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustom) { ...@@ -189,7 +170,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustom) {
// Tests that margin settings are saved correctly when printing with default // Tests that margin settings are saved correctly when printing with default
// margins selected. // margins selected.
TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsDefault) { TEST_F(PrintPreviewHandlerTest, StickyMarginsDefault) {
RequestPrintWithDefaultMargins(); RequestPrintWithDefaultMargins();
EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(1, browser()->tab_count());
...@@ -202,7 +183,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsDefault) { ...@@ -202,7 +183,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsDefault) {
// Tests that margin settings are saved correctly when printing with custom // Tests that margin settings are saved correctly when printing with custom
// margins selected and then again with default margins selected. // margins selected and then again with default margins selected.
TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustomThenDefault) { TEST_F(PrintPreviewHandlerTest, StickyMarginsCustomThenDefault) {
const double kMarginTop = 125.5; const double kMarginTop = 125.5;
const double kMarginRight = 126.5; const double kMarginRight = 126.5;
const double kMarginBottom = 127.5; const double kMarginBottom = 127.5;
...@@ -229,7 +210,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustomThenDefault) { ...@@ -229,7 +210,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_StickyMarginsCustomThenDefault) {
// Tests that margin settings are retrieved correctly after printing with custom // Tests that margin settings are retrieved correctly after printing with custom
// margins. // margins.
TEST_F(PrintPreviewHandlerTest, MAYBE_GetLastUsedMarginSettingsCustom) { TEST_F(PrintPreviewHandlerTest, GetLastUsedMarginSettingsCustom) {
const double kMarginTop = 125.5; const double kMarginTop = 125.5;
const double kMarginRight = 126.5; const double kMarginRight = 126.5;
const double kMarginBottom = 127.5; const double kMarginBottom = 127.5;
...@@ -259,7 +240,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_GetLastUsedMarginSettingsCustom) { ...@@ -259,7 +240,7 @@ TEST_F(PrintPreviewHandlerTest, MAYBE_GetLastUsedMarginSettingsCustom) {
// Tests that margin settings are retrieved correctly after printing with // Tests that margin settings are retrieved correctly after printing with
// default margins. // default margins.
TEST_F(PrintPreviewHandlerTest, MAYBE_GetLastUsedMarginSettingsDefault) { TEST_F(PrintPreviewHandlerTest, GetLastUsedMarginSettingsDefault) {
RequestPrintWithDefaultMargins(); RequestPrintWithDefaultMargins();
base::DictionaryValue initial_settings; base::DictionaryValue initial_settings;
preview_ui_->handler_->GetLastUsedMarginSettings(&initial_settings); preview_ui_->handler_->GetLastUsedMarginSettings(&initial_settings);
......
...@@ -31,19 +31,8 @@ size_t GetConstrainedWindowCount(TabContentsWrapper* tab) { ...@@ -31,19 +31,8 @@ size_t GetConstrainedWindowCount(TabContentsWrapper* tab) {
typedef BrowserWithTestWindowTest PrintPreviewUIUnitTest; typedef BrowserWithTestWindowTest PrintPreviewUIUnitTest;
// Test crashes on Aura due to initiator tab's native view having no parent.
// http://crbug.com/104284
#if defined(USE_AURA)
#define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages
#define MAYBE_PrintPreviewData DISABLED_PrintPreviewData
#define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus
#else
#define MAYBE_PrintPreviewData PrintPreviewData
#define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages
#define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus
#endif
// Create/Get a preview tab for initiator tab. // Create/Get a preview tab for initiator tab.
TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { TEST_F(PrintPreviewUIUnitTest, PrintPreviewData) {
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview);
ASSERT_TRUE(browser()); ASSERT_TRUE(browser());
BrowserList::SetLastActive(browser()); BrowserList::SetLastActive(browser());
...@@ -104,7 +93,7 @@ TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { ...@@ -104,7 +93,7 @@ TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) {
} }
// Set and get the individual draft pages. // Set and get the individual draft pages.
TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { TEST_F(PrintPreviewUIUnitTest, PrintPreviewDraftPages) {
#if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS)
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview);
#endif #endif
...@@ -173,7 +162,7 @@ TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { ...@@ -173,7 +162,7 @@ TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) {
} }
// Test the browser-side print preview cancellation functionality. // Test the browser-side print preview cancellation functionality.
TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { TEST_F(PrintPreviewUIUnitTest, GetCurrentPrintPreviewStatus) {
#if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS)
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment