| 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/profiles/profile_manager.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/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 23 | 24 |
| 24 class PreferenceServiceTest : public InProcessBrowserTest { | 25 class PreferenceServiceTest : public InProcessBrowserTest { |
| 25 public: | 26 public: |
| 26 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { | 27 explicit PreferenceServiceTest(bool new_profile) : new_profile_(new_profile) { |
| 27 } | 28 } |
| 28 | 29 |
| 29 virtual bool SetUpUserDataDirectory() OVERRIDE { | 30 virtual bool SetUpUserDataDirectory() OVERRIDE { |
| 30 FilePath user_data_directory; | 31 FilePath user_data_directory; |
| 31 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | 32 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); |
| 32 | 33 |
| 33 FilePath reference_pref_file; | 34 FilePath reference_pref_file; |
| 34 if (new_profile_) { | 35 if (new_profile_) { |
| 35 reference_pref_file = ui_test_utils::GetTestFilePath( | 36 reference_pref_file = ui_test_utils::GetTestFilePath( |
| 36 FilePath().AppendASCII("profiles"). | 37 FilePath().AppendASCII("profiles"). |
| 37 AppendASCII("window_placement"). | 38 AppendASCII("window_placement"). |
| 38 AppendASCII("Default"), | 39 AppendASCII("Default"), |
| 39 FilePath().Append(chrome::kPreferencesFilename)); | 40 FilePath().Append(chrome::kPreferencesFilename)); |
| 40 tmp_pref_file_ = user_data_directory.AppendASCII("Default"); | 41 tmp_pref_file_ = |
| 42 user_data_directory.AppendASCII(ProfileManager::kTestUserProfile); |
| 41 CHECK(file_util::CreateDirectory(tmp_pref_file_)); | 43 CHECK(file_util::CreateDirectory(tmp_pref_file_)); |
| 42 tmp_pref_file_ = tmp_pref_file_.Append(chrome::kPreferencesFilename); | 44 tmp_pref_file_ = tmp_pref_file_.Append(chrome::kPreferencesFilename); |
| 43 } else { | 45 } else { |
| 44 reference_pref_file = ui_test_utils::GetTestFilePath( | 46 reference_pref_file = ui_test_utils::GetTestFilePath( |
| 45 FilePath().AppendASCII("profiles"). | 47 FilePath().AppendASCII("profiles"). |
| 46 AppendASCII("window_placement"), | 48 AppendASCII("window_placement"), |
| 47 FilePath().Append(chrome::kLocalStateFilename)); | 49 FilePath().Append(chrome::kLocalStateFilename)); |
| 48 tmp_pref_file_ = user_data_directory.Append(chrome::kLocalStateFilename); | 50 tmp_pref_file_ = user_data_directory.Append(chrome::kLocalStateFilename); |
| 49 } | 51 } |
| 50 | 52 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 181 |
| 180 // Find if launched window is maximized. | 182 // Find if launched window is maximized. |
| 181 bool is_window_maximized = | 183 bool is_window_maximized = |
| 182 browser()->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; | 184 browser()->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; |
| 183 bool is_maximized = false; | 185 bool is_maximized = false; |
| 184 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", | 186 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", |
| 185 &is_maximized)); | 187 &is_maximized)); |
| 186 EXPECT_EQ(is_maximized, is_window_maximized); | 188 EXPECT_EQ(is_maximized, is_window_maximized); |
| 187 } | 189 } |
| 188 #endif | 190 #endif |
| OLD | NEW |