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 // 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 |
| 28 // the GTK code is going away, not spending more time on this. |
| 29 #if !defined(TOOLKIT_GTK) |
| 30 |
| 31 typedef InProcessBrowserTest PreservedWindowPlacement; |
| 32 |
| 33 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, PRE_Test) { |
| 34 browser()->window()->SetBounds(gfx::Rect(20, 30, 400, 500)); |
| 35 } |
| 36 |
| 37 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, Test) { |
| 38 gfx::Rect bounds = browser()->window()->GetBounds(); |
| 39 |
| 40 gfx::Rect expected_bounds(gfx::Rect(20, 30, 400, 500)); |
| 41 ASSERT_EQ(expected_bounds, bounds); |
| 42 } |
| 43 |
| 44 #endif // defined(TOOLKIT_GTK) |
| 45 |
26 class PreferenceServiceTest : public InProcessBrowserTest { | 46 class PreferenceServiceTest : public InProcessBrowserTest { |
27 public: | 47 public: |
28 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { | 48 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { |
29 } | 49 } |
30 | 50 |
31 virtual bool SetUpUserDataDirectory() OVERRIDE { | 51 virtual bool SetUpUserDataDirectory() OVERRIDE { |
32 FilePath user_data_directory; | 52 FilePath user_data_directory; |
33 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | 53 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); |
34 | 54 |
35 FilePath reference_pref_file; | 55 FilePath reference_pref_file; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 202 |
183 // Find if launched window is maximized. | 203 // Find if launched window is maximized. |
184 bool is_window_maximized = | 204 bool is_window_maximized = |
185 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | 205 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; |
186 bool is_maximized = false; | 206 bool is_maximized = false; |
187 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 207 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
188 &is_maximized)); | 208 &is_maximized)); |
189 EXPECT_EQ(is_maximized, is_window_maximized); | 209 EXPECT_EQ(is_maximized, is_window_maximized); |
190 } | 210 } |
191 #endif | 211 #endif |
OLD | NEW |