| OLD | NEW |
| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/extensions/component_loader.h" | 22 #include "chrome/browser/extensions/component_loader.h" |
| 23 #include "chrome/browser/extensions/extension_apitest.h" | 23 #include "chrome/browser/extensions/extension_apitest.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/extensions/extension_test_message_listener.h" | 25 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "chromeos/chromeos_switches.h" |
| 32 #include "content/public/browser/browser_context.h" | 33 #include "content/public/browser/browser_context.h" |
| 33 #include "content/public/browser/render_view_host.h" | 34 #include "content/public/browser/render_view_host.h" |
| 34 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
| 35 #include "webkit/fileapi/external_mount_points.h" | 36 #include "webkit/fileapi/external_mount_points.h" |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 const char kFileManagerExtensionId[] = "hhaomjibdihmijegdhdafkllkbggdgoj"; | 40 const char kFileManagerExtensionId[] = "hhaomjibdihmijegdhdafkllkbggdgoj"; |
| 40 | 41 |
| 41 const char kKeyboardTestFileName[] = "world.mpeg"; | 42 const char kKeyboardTestFileName[] = "world.mpeg"; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Files starting with . are filtered out in | 103 // Files starting with . are filtered out in |
| 103 // file_manager/js/directory_contents.js, so this should not be shown. | 104 // file_manager/js/directory_contents.js, so this should not be shown. |
| 104 CreateTestDirectory(".warez", "26 Oct 1985 13:39"); | 105 CreateTestDirectory(".warez", "26 Oct 1985 13:39"); |
| 105 | 106 |
| 106 ExtensionApiTest::SetUp(); | 107 ExtensionApiTest::SetUp(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 110 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 110 bool in_guest_mode = GetParam(); | 111 bool in_guest_mode = GetParam(); |
| 111 if (in_guest_mode) { | 112 if (in_guest_mode) { |
| 112 command_line->AppendSwitch(switches::kGuestSession); | 113 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
| 113 command_line->AppendSwitch(switches::kIncognito); | 114 command_line->AppendSwitch(switches::kIncognito); |
| 114 } | 115 } |
| 115 ExtensionApiTest::SetUpCommandLine(command_line); | 116 ExtensionApiTest::SetUpCommandLine(command_line); |
| 116 } | 117 } |
| 117 | 118 |
| 118 protected: | 119 protected: |
| 119 // Creates a file with the given |name|, |length|, and |modification_time|. | 120 // Creates a file with the given |name|, |length|, and |modification_time|. |
| 120 void CreateTestFile(const std::string& name, | 121 void CreateTestFile(const std::string& name, |
| 121 int length, | 122 int length, |
| 122 const std::string& modification_time); | 123 const std::string& modification_time); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 ResultCatcher catcher; | 344 ResultCatcher catcher; |
| 344 StartTest("keyboard delete"); | 345 StartTest("keyboard delete"); |
| 345 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 346 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 346 | 347 |
| 347 TestFilePathWatcher watcher(delete_path, | 348 TestFilePathWatcher watcher(delete_path, |
| 348 base::Bind(FileNotPresent)); | 349 base::Bind(FileNotPresent)); |
| 349 ASSERT_TRUE(watcher.RunMessageLoopUntilConditionSatisfied()); | 350 ASSERT_TRUE(watcher.RunMessageLoopUntilConditionSatisfied()); |
| 350 } | 351 } |
| 351 | 352 |
| 352 } // namespace | 353 } // namespace |
| OLD | NEW |