OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 // Stop IO thread here because no threads are allowed while | 287 // Stop IO thread here because no threads are allowed while |
288 // spawning sandbox host process. See crbug.com/322732. | 288 // spawning sandbox host process. See crbug.com/322732. |
289 embedded_test_server()->StopThread(); | 289 embedded_test_server()->StopThread(); |
290 | 290 |
291 InProcessBrowserTest::SetUp(); | 291 InProcessBrowserTest::SetUp(); |
292 } | 292 } |
293 | 293 |
294 bool SetUpUserDataDirectory() override { | 294 bool SetUpUserDataDirectory() override { |
295 if (UseWebView()) { | 295 if (UseWebView()) { |
296 // Enable webview signin. | 296 // Fake Dev channel to enable webview signin. |
297 scoped_channel_.reset(new extensions::ScopedCurrentChannel( | 297 scoped_channel_.reset(new extensions::ScopedCurrentChannel( |
298 chrome::VersionInfo::CHANNEL_DEV)); | 298 chrome::VersionInfo::CHANNEL_DEV)); |
299 | 299 |
300 base::DictionaryValue local_state_dict; | |
301 local_state_dict.SetBoolean(prefs::kWebviewSigninEnabled, true); | |
302 // OobeCompleted to skip controller-pairing-screen which still uses | |
303 // iframe and ends up in a JS error in oobe page init. | |
304 // See http://crbug.com/467147 | |
305 local_state_dict.SetBoolean(prefs::kOobeComplete, true); | |
306 | |
307 base::FilePath user_data_dir; | 300 base::FilePath user_data_dir; |
308 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 301 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
309 base::FilePath local_state_path = | 302 base::FilePath local_state_path = |
310 user_data_dir.Append(chrome::kLocalStateFilename); | 303 user_data_dir.Append(chrome::kLocalStateFilename); |
311 CHECK(JSONFileValueSerializer(local_state_path) | 304 |
312 .Serialize(local_state_dict)); | 305 // Set webview enabled flag only when local state file does not exist. |
| 306 // Otherwise, we break PRE tests that leave state in it. |
| 307 if (!base::PathExists(local_state_path)) { |
| 308 base::DictionaryValue local_state_dict; |
| 309 local_state_dict.SetBoolean(prefs::kWebviewSigninEnabled, true); |
| 310 // OobeCompleted to skip controller-pairing-screen which still uses |
| 311 // iframe and ends up in a JS error in oobe page init. |
| 312 // See http://crbug.com/467147 |
| 313 local_state_dict.SetBoolean(prefs::kOobeComplete, true); |
| 314 |
| 315 CHECK(JSONFileValueSerializer(local_state_path) |
| 316 .Serialize(local_state_dict)); |
| 317 } |
313 } | 318 } |
314 | 319 |
315 return InProcessBrowserTest::SetUpUserDataDirectory(); | 320 return InProcessBrowserTest::SetUpUserDataDirectory(); |
316 } | 321 } |
317 | 322 |
318 void SetUpInProcessBrowserTestFixture() override { | 323 void SetUpInProcessBrowserTestFixture() override { |
319 host_resolver()->AddRule("*", "127.0.0.1"); | 324 host_resolver()->AddRule("*", "127.0.0.1"); |
320 } | 325 } |
321 | 326 |
322 void SetUpCommandLine(base::CommandLine* command_line) override { | 327 void SetUpCommandLine(base::CommandLine* command_line) override { |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1248 |
1244 GetCookies(); | 1249 GetCookies(); |
1245 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); | 1250 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); |
1246 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); | 1251 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); |
1247 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); | 1252 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); |
1248 } | 1253 } |
1249 | 1254 |
1250 // TODO(xiyuan): Update once cookies are properly handled. | 1255 // TODO(xiyuan): Update once cookies are properly handled. |
1251 INSTANTIATE_TEST_CASE_P(SamlSuite, | 1256 INSTANTIATE_TEST_CASE_P(SamlSuite, |
1252 SAMLPolicyTest, | 1257 SAMLPolicyTest, |
1253 testing::Values(false)); | 1258 testing::Bool()); |
1254 | 1259 |
1255 } // namespace chromeos | 1260 } // namespace chromeos |
OLD | NEW |