| 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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Fails on Chrome OS as the browser thinks it is restarting after a crash, see | 33 // Fails on Chrome OS as the browser thinks it is restarting after a crash, see |
| 34 // http://crbug.com/168044 | 34 // http://crbug.com/168044 |
| 35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 36 #define MAYBE_Test DISABLED_Test | 36 #define MAYBE_Test DISABLED_Test |
| 37 #else | 37 #else |
| 38 #define MAYBE_Test Test | 38 #define MAYBE_Test Test |
| 39 #endif | 39 #endif |
| 40 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, MAYBE_Test) { | 40 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacement, MAYBE_Test) { |
| 41 #if defined(OS_WIN) && defined(USE_ASH) | 41 #if defined(OS_WIN) && defined(USE_ASH) |
| 42 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 42 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 43 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 43 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kAshBrowserTests)) |
| 44 return; | 45 return; |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 gfx::Rect bounds = browser()->window()->GetBounds(); | 48 gfx::Rect bounds = browser()->window()->GetBounds(); |
| 48 gfx::Rect expected_bounds(gfx::Rect(20, 30, 400, 500)); | 49 gfx::Rect expected_bounds(gfx::Rect(20, 30, 400, 500)); |
| 49 ASSERT_EQ(expected_bounds.ToString(), bounds.ToString()); | 50 ASSERT_EQ(expected_bounds.ToString(), bounds.ToString()); |
| 50 } | 51 } |
| 51 | 52 |
| 52 class PreferenceServiceTest : public InProcessBrowserTest { | 53 class PreferenceServiceTest : public InProcessBrowserTest { |
| 53 public: | 54 public: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 108 |
| 108 class PreservedWindowPlacementIsLoaded : public PreferenceServiceTest { | 109 class PreservedWindowPlacementIsLoaded : public PreferenceServiceTest { |
| 109 public: | 110 public: |
| 110 PreservedWindowPlacementIsLoaded() : PreferenceServiceTest(true) { | 111 PreservedWindowPlacementIsLoaded() : PreferenceServiceTest(true) { |
| 111 } | 112 } |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsLoaded, Test) { | 115 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsLoaded, Test) { |
| 115 #if defined(OS_WIN) && defined(USE_ASH) | 116 #if defined(OS_WIN) && defined(USE_ASH) |
| 116 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 117 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 117 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 118 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 119 switches::kAshBrowserTests)) |
| 118 return; | 120 return; |
| 119 #endif | 121 #endif |
| 120 | 122 |
| 121 // The window should open with the new reference profile, with window | 123 // The window should open with the new reference profile, with window |
| 122 // placement values stored in the user data directory. | 124 // placement values stored in the user data directory. |
| 123 JSONFileValueSerializer deserializer(original_pref_file_); | 125 JSONFileValueSerializer deserializer(original_pref_file_); |
| 124 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL)); | 126 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL)); |
| 125 | 127 |
| 126 ASSERT_TRUE(root.get()); | 128 ASSERT_TRUE(root.get()); |
| 127 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); | 129 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { | 170 class PreservedWindowPlacementIsMigrated : public PreferenceServiceTest { |
| 169 public: | 171 public: |
| 170 PreservedWindowPlacementIsMigrated() : PreferenceServiceTest(false) { | 172 PreservedWindowPlacementIsMigrated() : PreferenceServiceTest(false) { |
| 171 } | 173 } |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsMigrated, Test) { | 176 IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsMigrated, Test) { |
| 175 #if defined(OS_WIN) && defined(USE_ASH) | 177 #if defined(OS_WIN) && defined(USE_ASH) |
| 176 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 178 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 177 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 179 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 180 switches::kAshBrowserTests)) |
| 178 return; | 181 return; |
| 179 #endif | 182 #endif |
| 180 | 183 |
| 181 // The window should open with the old reference profile, with window | 184 // The window should open with the old reference profile, with window |
| 182 // placement values stored in Local State. | 185 // placement values stored in Local State. |
| 183 | 186 |
| 184 JSONFileValueSerializer deserializer(original_pref_file_); | 187 JSONFileValueSerializer deserializer(original_pref_file_); |
| 185 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL)); | 188 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL)); |
| 186 | 189 |
| 187 ASSERT_TRUE(root.get()); | 190 ASSERT_TRUE(root.get()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 EXPECT_EQ(right, bounds.x() + bounds.width()); | 223 EXPECT_EQ(right, bounds.x() + bounds.width()); |
| 221 | 224 |
| 222 // Find if launched window is maximized. | 225 // Find if launched window is maximized. |
| 223 bool is_window_maximized = browser()->window()->IsMaximized(); | 226 bool is_window_maximized = browser()->window()->IsMaximized(); |
| 224 bool is_maximized = false; | 227 bool is_maximized = false; |
| 225 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 228 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
| 226 &is_maximized)); | 229 &is_maximized)); |
| 227 EXPECT_EQ(is_maximized, is_window_maximized); | 230 EXPECT_EQ(is_maximized, is_window_maximized); |
| 228 } | 231 } |
| 229 #endif | 232 #endif |
| OLD | NEW |