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) | |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 int left = 0; | 138 int left = 0; |
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 |
148 #if defined(USE_AURA) | |
sky
2012/10/08 15:25:17
Why the ifdefs in this file?
Mr4D (OOO till 08-26)
2012/10/08 17:39:18
It was because of the "gtk" reference errors I've
| |
144 // Find if launched window is maximized. | 149 // Find if launched window is maximized. |
145 bool is_window_maximized = | 150 bool is_window_maximized = |
146 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | 151 browser()->window()->GetNativeWindow()->IsMaximized(); |
147 bool is_maximized = false; | 152 bool is_maximized = false; |
148 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 153 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
149 &is_maximized)); | 154 &is_maximized)); |
150 EXPECT_EQ(is_maximized, is_window_maximized); | 155 EXPECT_EQ(is_maximized, is_window_maximized); |
156 #endif | |
151 } | 157 } |
152 #endif | 158 #endif |
153 | 159 |
154 #if defined(OS_WIN) || defined(OS_MACOSX) | 160 #if defined(OS_WIN) || defined(OS_MACOSX) |
155 | 161 |
156 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { | 162 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { |
157 public: | 163 public: |
158 PreservedWindowPlacementIsMigrated() : PreferenceServiceTest(false) { | 164 PreservedWindowPlacementIsMigrated() : PreferenceServiceTest(false) { |
159 } | 165 } |
160 }; | 166 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 int left = 0; | 199 int left = 0; |
194 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", | 200 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".left", |
195 &left)); | 201 &left)); |
196 EXPECT_EQ(left, bounds.x()); | 202 EXPECT_EQ(left, bounds.x()); |
197 | 203 |
198 int right = 0; | 204 int right = 0; |
199 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", | 205 EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + ".right", |
200 &right)); | 206 &right)); |
201 EXPECT_EQ(right, bounds.x() + bounds.width()); | 207 EXPECT_EQ(right, bounds.x() + bounds.width()); |
202 | 208 |
209 #if defined(USE_AURA) | |
203 // Find if launched window is maximized. | 210 // Find if launched window is maximized. |
204 bool is_window_maximized = | 211 bool is_window_maximized = |
205 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | 212 browser()->window()->GetNativeWindow()->IsMaximized(); |
206 bool is_maximized = false; | 213 bool is_maximized = false; |
207 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 214 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
208 &is_maximized)); | 215 &is_maximized)); |
209 EXPECT_EQ(is_maximized, is_window_maximized); | 216 EXPECT_EQ(is_maximized, is_window_maximized); |
217 #endif | |
210 } | 218 } |
211 #endif | 219 #endif |
OLD | NEW |