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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.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/devtools/devtools_window.h" | |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/browser_window_state.h" | 18 #include "chrome/browser/ui/browser_window_state.h" |
18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "chrome/test/base/test_switches.h" | 23 #include "chrome/test/base/test_switches.h" |
23 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
24 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 EXPECT_EQ(right, bounds.x() + bounds.width()); | 221 EXPECT_EQ(right, bounds.x() + bounds.width()); |
221 | 222 |
222 // Find if launched window is maximized. | 223 // Find if launched window is maximized. |
223 bool is_window_maximized = browser()->window()->IsMaximized(); | 224 bool is_window_maximized = browser()->window()->IsMaximized(); |
224 bool is_maximized = false; | 225 bool is_maximized = false; |
225 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 226 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
226 &is_maximized)); | 227 &is_maximized)); |
227 EXPECT_EQ(is_maximized, is_window_maximized); | 228 EXPECT_EQ(is_maximized, is_window_maximized); |
228 } | 229 } |
229 #endif | 230 #endif |
231 | |
232 class AppWindowPlacementIsMigrated : public InProcessBrowserTest { | |
233 public: | |
234 virtual bool SetUpUserDataDirectory() OVERRIDE { | |
235 base::FilePath user_data_directory; | |
236 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | |
237 | |
238 base::FilePath original_pref_file = ui_test_utils::GetTestFilePath( | |
239 base::FilePath(FILE_PATH_LITERAL("profiles")). | |
240 AppendASCII("app_window_placement"). | |
241 AppendASCII("Default"), | |
242 base::FilePath().Append(chrome::kPreferencesFilename)); | |
243 base::FilePath tmp_pref_file = | |
244 user_data_directory.AppendASCII(TestingProfile::kTestUserProfileDir); | |
245 CHECK(base::CreateDirectory(tmp_pref_file)); | |
246 tmp_pref_file = tmp_pref_file.Append(chrome::kPreferencesFilename); | |
247 CHECK(base::PathExists(original_pref_file)); | |
248 CHECK(base::CopyFile(original_pref_file, tmp_pref_file)); | |
gab
2014/09/08 21:29:26
s/tmp_pref_file/test_pref_file ? (it's not really
| |
249 return true; | |
250 } | |
251 }; | |
252 | |
253 IN_PROC_BROWSER_TEST_F(AppWindowPlacementIsMigrated, Test) { | |
254 PrefService* prefs = browser()->profile()->GetPrefs(); | |
255 const base::DictionaryValue* browser_placement = | |
256 prefs->GetDictionary(prefs::kBrowserWindowPlacement); | |
257 EXPECT_NE(static_cast<base::DictionaryValue*>(NULL), browser_placement); | |
258 | |
259 const base::DictionaryValue* app_windows = | |
260 prefs->GetDictionary(prefs::kAppWindowPlacement); | |
261 EXPECT_NE(static_cast<base::DictionaryValue*>(NULL), browser_placement); | |
gab
2014/09/08 21:29:25
Also verify that things in this dictionary appear
| |
262 const base::DictionaryValue* dev_tools_dict = NULL; | |
263 app_windows->GetDictionary(DevToolsWindow::kDevToolsApp, &dev_tools_dict); | |
264 int right; | |
265 EXPECT_TRUE(dev_tools_dict->GetInteger("right", &right)); | |
266 EXPECT_EQ(721, right); | |
267 } | |
gab
2014/09/08 21:29:25
I think you also want to verify that other kBrowse
| |
OLD | NEW |