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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_manager_browsertest.cc

Issue 145813010: Files.app: add test for multi-profile desktop movement menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + review fix Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/background/js/test_util.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // Browser test for basic Chrome OS file manager functionality: 5 // Browser test for basic Chrome OS file manager functionality:
6 // - The file list is updated when a file is added externally to the Downloads 6 // - The file list is updated when a file is added externally to the Downloads
7 // folder. 7 // folder.
8 // - Selecting a file and copy-pasting it with the keyboard copies the file. 8 // - Selecting a file and copy-pasting it with the keyboard copies the file.
9 // - Selecting a file and pressing delete deletes it. 9 // - Selecting a file and pressing delete deletes it.
10 10
11 #include <deque> 11 #include <deque>
12 #include <string> 12 #include <string>
13 13
14 #include "apps/shell_window.h"
15 #include "apps/shell_window_registry.h"
14 #include "base/bind.h" 16 #include "base/bind.h"
15 #include "base/callback.h" 17 #include "base/callback.h"
16 #include "base/file_util.h" 18 #include "base/file_util.h"
17 #include "base/files/file_path.h" 19 #include "base/files/file_path.h"
18 #include "base/json/json_reader.h" 20 #include "base/json/json_reader.h"
19 #include "base/json/json_value_converter.h" 21 #include "base/json/json_value_converter.h"
20 #include "base/json/json_writer.h" 22 #include "base/json/json_writer.h"
21 #include "base/prefs/pref_service.h" 23 #include "base/prefs/pref_service.h"
22 #include "base/strings/string_piece.h" 24 #include "base/strings/string_piece.h"
23 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
24 #include "base/time/time.h" 26 #include "base/time/time.h"
25 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
27 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 29 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
28 #include "chrome/browser/chromeos/drive/file_system_interface.h" 30 #include "chrome/browser/chromeos/drive/file_system_interface.h"
29 #include "chrome/browser/chromeos/drive/test_util.h" 31 #include "chrome/browser/chromeos/drive/test_util.h"
32 #include "chrome/browser/chromeos/file_manager/app_id.h"
30 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" 33 #include "chrome/browser/chromeos/file_manager/drive_test_util.h"
31 #include "chrome/browser/chromeos/file_manager/path_util.h" 34 #include "chrome/browser/chromeos/file_manager/path_util.h"
32 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 35 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
33 #include "chrome/browser/chromeos/login/user_manager.h" 36 #include "chrome/browser/chromeos/login/user_manager.h"
34 #include "chrome/browser/chromeos/profiles/profile_helper.h" 37 #include "chrome/browser/chromeos/profiles/profile_helper.h"
35 #include "chrome/browser/drive/fake_drive_service.h" 38 #include "chrome/browser/drive/fake_drive_service.h"
36 #include "chrome/browser/extensions/api/test/test_api.h" 39 #include "chrome/browser/extensions/api/test/test_api.h"
37 #include "chrome/browser/extensions/component_loader.h" 40 #include "chrome/browser/extensions/component_loader.h"
38 #include "chrome/browser/extensions/extension_apitest.h" 41 #include "chrome/browser/extensions/extension_apitest.h"
39 #include "chrome/browser/extensions/extension_test_message_listener.h" 42 #include "chrome/browser/extensions/extension_test_message_listener.h"
40 #include "chrome/browser/profiles/profile.h" 43 #include "chrome/browser/profiles/profile.h"
41 #include "chrome/browser/profiles/profile_manager.h" 44 #include "chrome/browser/profiles/profile_manager.h"
45 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
46 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
42 #include "chrome/common/chrome_switches.h" 47 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/pref_names.h" 48 #include "chrome/common/pref_names.h"
44 #include "chromeos/chromeos_switches.h" 49 #include "chromeos/chromeos_switches.h"
45 #include "content/public/browser/browser_context.h" 50 #include "content/public/browser/browser_context.h"
46 #include "content/public/browser/notification_service.h" 51 #include "content/public/browser/notification_service.h"
47 #include "content/public/test/test_utils.h" 52 #include "content/public/test/test_utils.h"
48 #include "extensions/common/extension.h" 53 #include "extensions/common/extension.h"
49 #include "google_apis/drive/gdata_wapi_parser.h" 54 #include "google_apis/drive/gdata_wapi_parser.h"
50 #include "google_apis/drive/test_util.h" 55 #include "google_apis/drive/test_util.h"
51 #include "net/test/embedded_test_server/embedded_test_server.h" 56 #include "net/test/embedded_test_server/embedded_test_server.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 const TestAccountInfo& info = kTestAccounts[PRIMARY_ACCOUNT_INDEX]; 844 const TestAccountInfo& info = kTestAccounts[PRIMARY_ACCOUNT_INDEX];
840 845
841 AddUser(info, true); 846 AddUser(info, true);
842 chromeos::UserManager* const user_manager = chromeos::UserManager::Get(); 847 chromeos::UserManager* const user_manager = chromeos::UserManager::Get();
843 if (user_manager->GetActiveUser() != user_manager->FindUser(info.email)) 848 if (user_manager->GetActiveUser() != user_manager->FindUser(info.email))
844 chromeos::UserManager::Get()->SwitchActiveUser(info.email); 849 chromeos::UserManager::Get()->SwitchActiveUser(info.email);
845 FileManagerBrowserTestBase::SetUpOnMainThread(); 850 FileManagerBrowserTestBase::SetUpOnMainThread();
846 } 851 }
847 852
848 // Loads all users to the current session and sets up necessary fields. 853 // Loads all users to the current session and sets up necessary fields.
849 // This is used for preparing all acounts in PRE_ test setup, and for testing 854 // This is used for preparing all accounts in PRE_ test setup, and for testing
850 // actual login behavior. 855 // actual login behavior.
851 void AddAllUsers() { 856 void AddAllUsers() {
852 for (size_t i = 0; i < arraysize(kTestAccounts); ++i) 857 for (size_t i = 0; i < arraysize(kTestAccounts); ++i)
853 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); 858 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START);
854 } 859 }
855 860
856 // Returns primary profile (if it is already created.) 861 // Returns primary profile (if it is already created.)
857 virtual Profile* profile() OVERRIDE { 862 virtual Profile* profile() OVERRIDE {
858 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash( 863 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash(
859 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash); 864 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash);
(...skipping 21 matching lines...) Expand all
881 886
882 virtual const char* GetTestCaseNameParam() const OVERRIDE { 887 virtual const char* GetTestCaseNameParam() const OVERRIDE {
883 return test_case_name_.c_str(); 888 return test_case_name_.c_str();
884 } 889 }
885 890
886 virtual std::string OnMessage(const std::string& name, 891 virtual std::string OnMessage(const std::string& name,
887 const base::Value* value) OVERRIDE { 892 const base::Value* value) OVERRIDE {
888 if (name == "addAllUsers") { 893 if (name == "addAllUsers") {
889 AddAllUsers(); 894 AddAllUsers();
890 return "true"; 895 return "true";
896 } else if (name == "getWindowOwnerId") {
897 chrome::MultiUserWindowManager* const window_manager =
898 chrome::MultiUserWindowManager::GetInstance();
899 apps::ShellWindowRegistry* const shell_window_registry =
900 apps::ShellWindowRegistry::Get(profile());
901 DCHECK(window_manager);
902 DCHECK(shell_window_registry);
903
904 const apps::ShellWindowRegistry::ShellWindowList& list =
905 shell_window_registry->GetShellWindowsForApp(
906 file_manager::kFileManagerAppId);
907 return list.size() == 1u ?
908 window_manager->GetUserPresentingWindow(
909 list.front()->GetNativeWindow()) : "";
891 } 910 }
892 return FileManagerBrowserTestBase::OnMessage(name, value); 911 return FileManagerBrowserTestBase::OnMessage(name, value);
893 } 912 }
894 913
895 std::string test_case_name_; 914 std::string test_case_name_;
896 }; 915 };
897 916
898 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, PRE_BasicDownloads) { 917 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, PRE_BasicDownloads) {
899 AddAllUsers(); 918 AddAllUsers();
900 } 919 }
(...skipping 20 matching lines...) Expand all
921 940
922 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, PRE_Badge) { 941 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, PRE_Badge) {
923 AddAllUsers(); 942 AddAllUsers();
924 } 943 }
925 944
926 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, Badge) { 945 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, Badge) {
927 set_test_case_name("multiProfileBadge"); 946 set_test_case_name("multiProfileBadge");
928 StartTest(); 947 StartTest();
929 } 948 }
930 949
950 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest,
951 PRE_VisitDesktopMenu) {
952 AddAllUsers();
953 }
954
955 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, VisitDesktopMenu) {
956 set_test_case_name("multiProfileVisitDesktopMenu");
957 StartTest();
958 }
959
931 // TODO(kinaba) write more tests. 960 // TODO(kinaba) write more tests.
932 961
933 } // namespace 962 } // namespace
934 } // namespace file_manager 963 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/background/js/test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698