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

Side by Side Diff: chrome/browser/extensions/extension_file_browser_private_apitest.cc

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix memory leaks in tests Created 8 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
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" 8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "webkit/fileapi/file_system_context.h" 14 #include "webkit/fileapi/file_system_context.h"
15 #include "webkit/fileapi/file_system_mount_point_provider.h" 15 #include "webkit/fileapi/file_system_mount_point_provider.h"
16 16
17 using ::testing::_; 17 using ::testing::_;
18 using ::testing::ReturnRef; 18 using ::testing::ReturnRef;
19 using ::testing::StrEq; 19 using ::testing::StrEq;
20 using content::BrowserContext;
20 21
21 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { 22 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest {
22 public: 23 public:
23 ExtensionFileBrowserPrivateApiTest() 24 ExtensionFileBrowserPrivateApiTest()
24 : disk_mount_manager_mock_(NULL), 25 : disk_mount_manager_mock_(NULL),
25 test_mount_point_("/tmp") { 26 test_mount_point_("/tmp") {
26 CreateVolumeMap(); 27 CreateVolumeMap();
27 } 28 }
28 29
29 virtual ~ExtensionFileBrowserPrivateApiTest() { 30 virtual ~ExtensionFileBrowserPrivateApiTest() {
(...skipping 14 matching lines...) Expand all
44 // ExtensionApiTest override 45 // ExtensionApiTest override
45 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { 46 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
46 chromeos::disks::DiskMountManager::Shutdown(); 47 chromeos::disks::DiskMountManager::Shutdown();
47 disk_mount_manager_mock_ = NULL; 48 disk_mount_manager_mock_ = NULL;
48 49
49 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); 50 ExtensionApiTest::TearDownInProcessBrowserTestFixture();
50 } 51 }
51 52
52 void AddTmpMountPoint() { 53 void AddTmpMountPoint() {
53 fileapi::ExternalFileSystemMountPointProvider* provider = 54 fileapi::ExternalFileSystemMountPointProvider* provider =
54 browser()->profile()->GetFileSystemContext()->external_provider(); 55 BrowserContext::GetFileSystemContext(browser()->profile())->
56 external_provider();
55 provider->AddMountPoint(test_mount_point_); 57 provider->AddMountPoint(test_mount_point_);
56 } 58 }
57 59
58 private: 60 private:
59 void CreateVolumeMap() { 61 void CreateVolumeMap() {
60 // These have to be sync'd with values in filebrowser_mount extension. 62 // These have to be sync'd with values in filebrowser_mount extension.
61 volumes_.insert( 63 volumes_.insert(
62 std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( 64 std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>(
63 "device_path1", 65 "device_path1",
64 new chromeos::disks::DiskMountManager::Disk( 66 new chromeos::disks::DiskMountManager::Disk(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); 134 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1);
133 135
134 EXPECT_CALL(*disk_mount_manager_mock_, disks()) 136 EXPECT_CALL(*disk_mount_manager_mock_, disks())
135 .WillRepeatedly(ReturnRef(volumes_)); 137 .WillRepeatedly(ReturnRef(volumes_));
136 138
137 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; 139 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_;
138 140
139 ui_test_utils::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 141 ui_test_utils::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
140 ui_test_utils::RunAllPendingInMessageLoop(); 142 ui_test_utils::RunAllPendingInMessageLoop();
141 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698