OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return base::CommandLine::ForCurrentProcess() | 139 return base::CommandLine::ForCurrentProcess() |
140 ->GetSwitchValuePath(::switches::kUserDataDir) | 140 ->GetSwitchValuePath(::switches::kUserDataDir) |
141 .Append(kRefreshTokenToDeviceIdMapFile); | 141 .Append(kRefreshTokenToDeviceIdMapFile); |
142 } | 142 } |
143 | 143 |
144 void LoadRefreshTokenToDeviceIdMap() { | 144 void LoadRefreshTokenToDeviceIdMap() { |
145 std::string file_contents; | 145 std::string file_contents; |
146 if (!base::ReadFileToString(GetRefreshTokenToDeviceIdMapFilePath(), | 146 if (!base::ReadFileToString(GetRefreshTokenToDeviceIdMapFilePath(), |
147 &file_contents)) | 147 &file_contents)) |
148 return; | 148 return; |
149 scoped_ptr<base::Value> value(base::JSONReader::Read(file_contents)); | 149 std::unique_ptr<base::Value> value(base::JSONReader::Read(file_contents)); |
150 base::DictionaryValue* dictionary; | 150 base::DictionaryValue* dictionary; |
151 EXPECT_TRUE(value->GetAsDictionary(&dictionary)); | 151 EXPECT_TRUE(value->GetAsDictionary(&dictionary)); |
152 FakeGaia::RefreshTokenToDeviceIdMap map; | 152 FakeGaia::RefreshTokenToDeviceIdMap map; |
153 for (base::DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd(); | 153 for (base::DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd(); |
154 it.Advance()) { | 154 it.Advance()) { |
155 std::string device_id; | 155 std::string device_id; |
156 EXPECT_TRUE(it.value().GetAsString(&device_id)); | 156 EXPECT_TRUE(it.value().GetAsString(&device_id)); |
157 map[it.key()] = device_id; | 157 map[it.key()] = device_id; |
158 } | 158 } |
159 fake_gaia_->SetRefreshTokenToDeviceIdMap(map); | 159 fake_gaia_->SetRefreshTokenToDeviceIdMap(map); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 IN_PROC_BROWSER_TEST_F(DeviceIDTest, LegacyUsers) { | 288 IN_PROC_BROWSER_TEST_F(DeviceIDTest, LegacyUsers) { |
289 EXPECT_TRUE(GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)).empty()); | 289 EXPECT_TRUE(GetDeviceId(AccountId::FromUserEmail(kFakeUserEmail)).empty()); |
290 SignInOffline(kFakeUserEmail, kFakeUserPassword); | 290 SignInOffline(kFakeUserEmail, kFakeUserPassword); |
291 // Last param |auth_code| is empty, because we don't pass a device ID to GAIA | 291 // Last param |auth_code| is empty, because we don't pass a device ID to GAIA |
292 // in this case. | 292 // in this case. |
293 CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail), | 293 CheckDeviceIDIsConsistent(AccountId::FromUserEmail(kFakeUserEmail), |
294 std::string()); | 294 std::string()); |
295 } | 295 } |
296 | 296 |
297 } // namespace chromeos | 297 } // namespace chromeos |
OLD | NEW |