| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 20 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" |
| 21 #include "chrome/browser/chromeos/gdata/mock_gdata_documents_service.h" | 21 #include "chrome/browser/chromeos/gdata/mock_gdata_documents_service.h" |
| 22 #include "chrome/browser/extensions/extension_apitest.h" | 22 #include "chrome/browser/extensions/extension_apitest.h" |
| 23 #include "chrome/browser/extensions/extension_test_message_listener.h" | 23 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| 27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/test/base/ui_test_utils.h" | |
| 30 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/test/test_utils.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "webkit/fileapi/file_system_context.h" | 33 #include "webkit/fileapi/file_system_context.h" |
| 34 #include "webkit/fileapi/file_system_mount_point_provider.h" | 34 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 35 | 35 |
| 36 using ::testing::_; | 36 using ::testing::_; |
| 37 using ::testing::Return; | 37 using ::testing::Return; |
| 38 using content::BrowserContext; | 38 using content::BrowserContext; |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // (instead of calling chrome.test.succeed in js). | 77 // (instead of calling chrome.test.succeed in js). |
| 78 void WaitUntilLoaded() { | 78 void WaitUntilLoaded() { |
| 79 page_created_.Wait(); | 79 page_created_.Wait(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WaitUntilClosed() { | 82 void WaitUntilClosed() { |
| 83 page_closed_.Wait(); | 83 page_closed_.Wait(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 ui_test_utils::WindowedNotificationObserver page_created_; | 87 content::WindowedNotificationObserver page_created_; |
| 88 ui_test_utils::WindowedNotificationObserver page_closed_; | 88 content::WindowedNotificationObserver page_closed_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // TODO(tbarzic): We should probably share GetTestFilePath and LoadJSONFile | 91 // TODO(tbarzic): We should probably share GetTestFilePath and LoadJSONFile |
| 92 // with gdata_file_system_unittest. | 92 // with gdata_file_system_unittest. |
| 93 // Generates file path in gdata test directory for a file with name |filename|. | 93 // Generates file path in gdata test directory for a file with name |filename|. |
| 94 FilePath GetTestFilePath(const FilePath::StringType& filename) { | 94 FilePath GetTestFilePath(const FilePath::StringType& filename) { |
| 95 FilePath path; | 95 FilePath path; |
| 96 std::string error; | 96 std::string error; |
| 97 PathService::Get(chrome::DIR_TEST_DATA, &path); | 97 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 98 path = path.AppendASCII("chromeos") | 98 path = path.AppendASCII("chromeos") |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 EXPECT_CALL(*mock_documents_service_, CancelAll()); | 355 EXPECT_CALL(*mock_documents_service_, CancelAll()); |
| 356 // This one is called on exit, but we don't care much about it, as long as it | 356 // This one is called on exit, but we don't care much about it, as long as it |
| 357 // retunrs something valid (i.e. not NULL). | 357 // retunrs something valid (i.e. not NULL). |
| 358 EXPECT_CALL(*mock_documents_service_, operation_registry()). | 358 EXPECT_CALL(*mock_documents_service_, operation_registry()). |
| 359 WillRepeatedly(Return(operation_registry_.get())); | 359 WillRepeatedly(Return(operation_registry_.get())); |
| 360 | 360 |
| 361 // All is set... RUN THE TEST. | 361 // All is set... RUN THE TEST. |
| 362 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", | 362 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", |
| 363 kComponentFlags)) << message_; | 363 kComponentFlags)) << message_; |
| 364 } | 364 } |
| OLD | NEW |