Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/test/remoting/remote_desktop_browsertest.h" | 5 #include "chrome/test/remoting/remote_desktop_browsertest.h" |
| 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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/macros.h" | |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/unpacked_installer.h" | 13 #include "chrome/browser/extensions/unpacked_installer.h" |
| 13 #include "chrome/browser/ui/extensions/app_launch_params.h" | 14 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 14 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
| 15 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/test/remoting/key_code_conv.h" | 18 #include "chrome/test/remoting/key_code_conv.h" |
| 18 #include "chrome/test/remoting/page_load_notification_observer.h" | 19 #include "chrome/test/remoting/page_load_notification_observer.h" |
| 19 #include "chrome/test/remoting/waiter.h" | 20 #include "chrome/test/remoting/waiter.h" |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 | 852 |
| 852 void RemoteDesktopBrowserTest::SetUserNameAndPassword( | 853 void RemoteDesktopBrowserTest::SetUserNameAndPassword( |
| 853 const base::FilePath &accounts_file_path, const std::string& account_type) { | 854 const base::FilePath &accounts_file_path, const std::string& account_type) { |
| 854 | 855 |
| 855 // Read contents of accounts file, using its absolute path. | 856 // Read contents of accounts file, using its absolute path. |
| 856 base::FilePath absolute_path = base::MakeAbsoluteFilePath(accounts_file_path); | 857 base::FilePath absolute_path = base::MakeAbsoluteFilePath(accounts_file_path); |
| 857 std::string accounts_info; | 858 std::string accounts_info; |
| 858 ASSERT_TRUE(base::ReadFileToString(absolute_path, &accounts_info)); | 859 ASSERT_TRUE(base::ReadFileToString(absolute_path, &accounts_info)); |
| 859 | 860 |
| 860 // Get the root dictionary from the input json file contents. | 861 // Get the root dictionary from the input json file contents. |
| 861 scoped_ptr<base::Value> root(base::JSONReader::DeprecatedRead( | 862 scoped_ptr<base::Value> root = |
| 862 accounts_info, base::JSON_ALLOW_TRAILING_COMMAS)); | 863 base::JSONReader::Read(accounts_info, base::JSON_ALLOW_TRAILING_COMMAS); |
| 863 | 864 |
| 864 const base::DictionaryValue* root_dict = NULL; | 865 const base::DictionaryValue* root_dict = NULL; |
| 865 ASSERT_TRUE(root.get() && root->GetAsDictionary(&root_dict)); | 866 ASSERT_TRUE(root.get() && root->GetAsDictionary(&root_dict)); |
| 867 ignore_result(root.release()); | |
|
sky
2015/09/09 16:03:03
Where does root get destroyed?
| |
| 866 | 868 |
| 867 // Now get the dictionary for the specified account type. | 869 // Now get the dictionary for the specified account type. |
| 868 const base::DictionaryValue* account_dict = NULL; | 870 const base::DictionaryValue* account_dict = NULL; |
| 869 ASSERT_TRUE(root_dict->GetDictionary(account_type, &account_dict)); | 871 ASSERT_TRUE(root_dict->GetDictionary(account_type, &account_dict)); |
| 870 ASSERT_TRUE(account_dict->GetString(kUserName, &username_)); | 872 ASSERT_TRUE(account_dict->GetString(kUserName, &username_)); |
| 871 ASSERT_TRUE(account_dict->GetString(kUserPassword, &password_)); | 873 ASSERT_TRUE(account_dict->GetString(kUserPassword, &password_)); |
| 872 } | 874 } |
| 873 | 875 |
| 874 // static | 876 // static |
| 875 bool RemoteDesktopBrowserTest::IsAuthenticatedInWindow( | 877 bool RemoteDesktopBrowserTest::IsAuthenticatedInWindow( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 | 923 |
| 922 ConditionalTimeoutWaiter homeWaiter( | 924 ConditionalTimeoutWaiter homeWaiter( |
| 923 base::TimeDelta::FromSeconds(5), | 925 base::TimeDelta::FromSeconds(5), |
| 924 base::TimeDelta::FromMilliseconds(500), | 926 base::TimeDelta::FromMilliseconds(500), |
| 925 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, | 927 base::Bind(&RemoteDesktopBrowserTest::IsAppModeEqualTo, |
| 926 this, "remoting.AppMode.HOME")); | 928 this, "remoting.AppMode.HOME")); |
| 927 EXPECT_TRUE(homeWaiter.Wait()); | 929 EXPECT_TRUE(homeWaiter.Wait()); |
| 928 } | 930 } |
| 929 | 931 |
| 930 } // namespace remoting | 932 } // namespace remoting |
| OLD | NEW |