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

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

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: move dep to chromeos section Created 4 years 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
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/ui/BUILD.gn » ('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) 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/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 11 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
12 #include "chrome/browser/chromeos/drive/file_system_util.h" 12 #include "chrome/browser/chromeos/drive/file_system_util.h"
13 #include "chrome/browser/chromeos/file_manager/mount_test_util.h" 13 #include "chrome/browser/chromeos/file_manager/mount_test_util.h"
14 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 14 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" 15 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/extensions/extension_apitest.h" 16 #include "chrome/browser/extensions/extension_apitest.h"
17 #include "chrome/browser/media/router/mock_media_router.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/ui/ash/cast_config_client_media_router.h"
19 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
22 #include "components/drive/service/fake_drive_service.h" 24 #include "components/drive/service/fake_drive_service.h"
23 #include "components/session_manager/core/session_manager.h" 25 #include "components/session_manager/core/session_manager.h"
24 #include "content/public/browser/browser_context.h" 26 #include "content/public/browser/browser_context.h"
25 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
26 #include "content/public/test/test_utils.h" 28 #include "content/public/test/test_utils.h"
27 #include "extensions/browser/notification_types.h" 29 #include "extensions/browser/notification_types.h"
28 #include "extensions/test/result_catcher.h" 30 #include "extensions/test/result_catcher.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 FileSystemExtensionApiTestBase() {} 363 FileSystemExtensionApiTestBase() {}
362 ~FileSystemExtensionApiTestBase() override {} 364 ~FileSystemExtensionApiTestBase() override {}
363 365
364 void SetUp() override { 366 void SetUp() override {
365 InitTestFileSystem(); 367 InitTestFileSystem();
366 ExtensionApiTest::SetUp(); 368 ExtensionApiTest::SetUp();
367 } 369 }
368 370
369 void SetUpOnMainThread() override { 371 void SetUpOnMainThread() override {
370 AddTestMountPoint(); 372 AddTestMountPoint();
373
374 // Mock the Media Router in extension api tests. Dispatches to the message
375 // loop now try to handle mojo messages that will call back into Profile
376 // creation through the media router, which then confuse the drive code.
377 ON_CALL(media_router_, RegisterMediaSinksObserver(testing::_))
378 .WillByDefault(testing::Return(true));
379 CastConfigClientMediaRouter::SetMediaRouterForTest(&media_router_);
380
371 ExtensionApiTest::SetUpOnMainThread(); 381 ExtensionApiTest::SetUpOnMainThread();
372 } 382 }
373 383
384 void TearDownOnMainThread() override {
385 CastConfigClientMediaRouter::SetMediaRouterForTest(nullptr);
386 ExtensionApiTest::TearDownOnMainThread();
387 }
388
374 // Runs a file system extension API test. 389 // Runs a file system extension API test.
375 // It loads test component extension at |filebrowser_path| with manifest 390 // It loads test component extension at |filebrowser_path| with manifest
376 // at |filebrowser_manifest|. The |filebrowser_manifest| should be a path 391 // at |filebrowser_manifest|. The |filebrowser_manifest| should be a path
377 // relative to |filebrowser_path|. The method waits until the test extension 392 // relative to |filebrowser_path|. The method waits until the test extension
378 // sends test succeed or fail message. It returns true if the test succeeds. 393 // sends test succeed or fail message. It returns true if the test succeeds.
379 // If |FLAGS_USE_FILE_HANDLER| flag is set, the file handler extension at path 394 // If |FLAGS_USE_FILE_HANDLER| flag is set, the file handler extension at path
380 // |filehandler_path| will be loaded before the file browser extension. 395 // |filehandler_path| will be loaded before the file browser extension.
381 // If the flag FLAGS_LAZY_FILE_HANDLER is set, the file handler extension must 396 // If the flag FLAGS_LAZY_FILE_HANDLER is set, the file handler extension must
382 // not have persistent background page. The test will wait until the file 397 // not have persistent background page. The test will wait until the file
383 // handler's background page is closed after initial load before the file 398 // handler's background page is closed after initial load before the file
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 437 }
423 438
424 return true; 439 return true;
425 } 440 }
426 441
427 protected: 442 protected:
428 // Sets up initial test file system hierarchy. 443 // Sets up initial test file system hierarchy.
429 virtual void InitTestFileSystem() = 0; 444 virtual void InitTestFileSystem() = 0;
430 // Registers mount point used in the test. 445 // Registers mount point used in the test.
431 virtual void AddTestMountPoint() = 0; 446 virtual void AddTestMountPoint() = 0;
447
448 private:
449 media_router::MockMediaRouter media_router_;
450
451 DISALLOW_COPY_AND_ASSIGN(FileSystemExtensionApiTestBase);
432 }; 452 };
433 453
434 // Tests for a native local file system. 454 // Tests for a native local file system.
435 class LocalFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase { 455 class LocalFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase {
436 public: 456 public:
437 LocalFileSystemExtensionApiTest() {} 457 LocalFileSystemExtensionApiTest() {}
438 ~LocalFileSystemExtensionApiTest() override {} 458 ~LocalFileSystemExtensionApiTest() override {}
439 459
440 // FileSystemExtensionApiTestBase override. 460 // FileSystemExtensionApiTestBase override.
441 void InitTestFileSystem() override { 461 void InitTestFileSystem() override {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 AppFileHandlerMulti) { 875 AppFileHandlerMulti) {
856 EXPECT_TRUE( 876 EXPECT_TRUE(
857 RunFileSystemExtensionApiTest("file_browser/app_file_handler_multi", 877 RunFileSystemExtensionApiTest("file_browser/app_file_handler_multi",
858 FILE_PATH_LITERAL("manifest.json"), 878 FILE_PATH_LITERAL("manifest.json"),
859 "", 879 "",
860 FLAGS_NONE)) 880 FLAGS_NONE))
861 << message_; 881 << message_;
862 } 882 }
863 } // namespace 883 } // namespace
864 } // namespace file_manager 884 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698