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 typedef InProcessBrowserTest PreservedWindowPlacement; |
| 27 |
| 28 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, PRE_Test) { |
| 29 browser()->window()->SetBounds(gfx::Rect(10, 20, 300, 400)); |
| 30 } |
| 31 |
| 32 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, Test) { |
| 33 gfx::Rect bounds; |
| 34 bounds = browser()->window()->GetRestoredBounds(); |
| 35 |
| 36 gfx::Rect expected_bounds(gfx::Rect(10, 20, 300, 400)); |
| 37 ASSERT_EQ(expected_bounds, bounds); |
| 38 } |
| 39 |
26 class PreferenceServiceTest : public InProcessBrowserTest { | 40 class PreferenceServiceTest : public InProcessBrowserTest { |
27 public: | 41 public: |
28 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { | 42 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { |
29 } | 43 } |
30 | 44 |
31 virtual bool SetUpUserDataDirectory() OVERRIDE { | 45 virtual bool SetUpUserDataDirectory() OVERRIDE { |
32 FilePath user_data_directory; | 46 FilePath user_data_directory; |
33 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | 47 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); |
34 | 48 |
35 FilePath reference_pref_file; | 49 FilePath reference_pref_file; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 196 |
183 // Find if launched window is maximized. | 197 // Find if launched window is maximized. |
184 bool is_window_maximized = | 198 bool is_window_maximized = |
185 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; | 199 chrome::GetSavedWindowShowState(browser()) == ui::SHOW_STATE_MAXIMIZED; |
186 bool is_maximized = false; | 200 bool is_maximized = false; |
187 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 201 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
188 &is_maximized)); | 202 &is_maximized)); |
189 EXPECT_EQ(is_maximized, is_window_maximized); | 203 EXPECT_EQ(is_maximized, is_window_maximized); |
190 } | 204 } |
191 #endif | 205 #endif |
OLD | NEW |