Chromium Code Reviews| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 12 #include "base/test/test_file_util.h" | 12 #include "base/test/test_file_util.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/browser_window_state.h" | 17 #include "chrome/browser/ui/browser_window_state.h" |
| 18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 25 | 25 |
| 26 #if defined(USE_AURA) | |
|
sky
2012/10/08 21:01:25
This shouldn't be needed.
Mr4D (OOO till 08-26)
2012/10/08 23:04:27
Right - not anymore! Done.
| |
| 27 #include "ui/aura/window.h" | |
| 28 #endif | |
| 29 | |
| 26 // On GTK, resizing happens asynchronously and we currently don't have a way to | 30 // On GTK, resizing happens asynchronously and we currently don't have a way to |
| 27 // get called back (it's probably possible, but we don't have that code). Since | 31 // get called back (it's probably possible, but we don't have that code). Since |
| 28 // the GTK code is going away, not spending more time on this. | 32 // the GTK code is going away, not spending more time on this. |
| 29 #if !defined(TOOLKIT_GTK) | 33 #if !defined(TOOLKIT_GTK) |
| 30 | 34 |
| 31 typedef InProcessBrowserTest PreservedWindowPlacement; | 35 typedef InProcessBrowserTest PreservedWindowPlacement; |
| 32 | 36 |
| 33 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, PRE_Test) { | 37 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, PRE_Test) { |
| 34 browser()->window()->SetBounds(gfx::Rect(20, 30, 400, 500)); | 38 browser()->window()->SetBounds(gfx::Rect(20, 30, 400, 500)); |
| 35 } | 39 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", | 139 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", |
| 136 &left)); | 140 &left)); |
| 137 EXPECT_EQ(left, bounds.x()); | 141 EXPECT_EQ(left, bounds.x()); |
| 138 | 142 |
| 139 int right = 0; | 143 int right = 0; |
| 140 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", | 144 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", |
| 141 &right)); | 145 &right)); |
| 142 EXPECT_EQ(right, bounds.x() + bounds.width()); | 146 EXPECT_EQ(right, bounds.x() + bounds.width()); |
| 143 | 147 |
| 144 // Find if launched window is maximized. | 148 // Find if launched window is maximized. |
| 145 bool is_window_maximized = | 149 bool is_window_maximized = browser()->window()->IsMaximized(); |
| 146 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | |
| 147 bool is_maximized = false; | 150 bool is_maximized = false; |
| 148 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 151 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
| 149 &is_maximized)); | 152 &is_maximized)); |
| 150 EXPECT_EQ(is_maximized, is_window_maximized); | 153 EXPECT_EQ(is_maximized, is_window_maximized); |
| 151 } | 154 } |
| 152 #endif | 155 #endif |
| 153 | 156 |
| 154 #if defined(OS_WIN) || defined(OS_MACOSX) | 157 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 155 | 158 |
| 156 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { | 159 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", | 197 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", |
| 195 &left)); | 198 &left)); |
| 196 EXPECT_EQ(left, bounds.x()); | 199 EXPECT_EQ(left, bounds.x()); |
| 197 | 200 |
| 198 int right = 0; | 201 int right = 0; |
| 199 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", | 202 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", |
| 200 &right)); | 203 &right)); |
| 201 EXPECT_EQ(right, bounds.x() + bounds.width()); | 204 EXPECT_EQ(right, bounds.x() + bounds.width()); |
| 202 | 205 |
| 203 // Find if launched window is maximized. | 206 // Find if launched window is maximized. |
| 204 bool is_window_maximized = | 207 bool is_window_maximized = browser()->window()->IsMaximized(); |
| 205 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | |
| 206 bool is_maximized = false; | 208 bool is_maximized = false; |
| 207 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 209 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
| 208 &is_maximized)); | 210 &is_maximized)); |
| 209 EXPECT_EQ(is_maximized, is_window_maximized); | 211 EXPECT_EQ(is_maximized, is_window_maximized); |
| 210 } | 212 } |
| 211 #endif | 213 #endif |
| OLD | NEW |