Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: chrome/browser/prefs/pref_service_browsertest.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/prefs/incognito_mode_prefs.cc ('k') | chrome/browser/prefs/pref_service_syncable_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698