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 #include "base/command_line.h" | 4 #include "base/command_line.h" |
5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/timer.h" | 6 #include "base/timer.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r.h" | 8 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 SystemInfoStorageApiTest() {} | 95 SystemInfoStorageApiTest() {} |
96 virtual ~SystemInfoStorageApiTest() {} | 96 virtual ~SystemInfoStorageApiTest() {} |
97 | 97 |
98 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 98 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
99 ExtensionApiTest::SetUpCommandLine(command_line); | 99 ExtensionApiTest::SetUpCommandLine(command_line); |
100 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 100 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
101 } | 101 } |
102 | 102 |
103 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 103 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
104 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 104 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
105 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 105 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
106 } | 106 } |
107 | 107 |
108 void ProcessAttach(const std::string& device_id, | 108 void ProcessAttach(const std::string& device_id, |
109 const string16& name, | 109 const string16& name, |
110 const base::FilePath::StringType& location) { | 110 const base::FilePath::StringType& location) { |
111 chrome::StorageInfo info(device_id, name, location, | 111 chrome::StorageInfo info(device_id, name, location, |
112 string16(), string16(), string16(), 0); | 112 string16(), string16(), string16(), 0); |
113 StorageMonitor::GetInstance()->receiver()->ProcessAttach(info); | 113 StorageMonitor::GetInstance()->receiver()->ProcessAttach(info); |
114 } | 114 } |
115 | 115 |
116 void ProcessDetach(const std::string& id) { | 116 void ProcessDetach(const std::string& id) { |
117 StorageMonitor::GetInstance()->receiver()->ProcessDetach(id); | 117 StorageMonitor::GetInstance()->receiver()->ProcessDetach(id); |
118 } | 118 } |
119 | 119 |
120 private: | 120 private: |
121 scoped_ptr<MessageLoop> message_loop_; | 121 scoped_ptr<base::MessageLoop> message_loop_; |
122 }; | 122 }; |
123 | 123 |
124 IN_PROC_BROWSER_TEST_F(SystemInfoStorageApiTest, Storage) { | 124 IN_PROC_BROWSER_TEST_F(SystemInfoStorageApiTest, Storage) { |
125 TestStorageInfoProvider* provider = | 125 TestStorageInfoProvider* provider = |
126 new TestStorageInfoProvider(kTestingData, arraysize(kTestingData)); | 126 new TestStorageInfoProvider(kTestingData, arraysize(kTestingData)); |
127 StorageInfoProvider::InitializeForTesting(provider); | 127 StorageInfoProvider::InitializeForTesting(provider); |
128 ASSERT_TRUE(RunPlatformAppTest("systeminfo/storage")) << message_; | 128 ASSERT_TRUE(RunPlatformAppTest("systeminfo/storage")) << message_; |
129 } | 129 } |
130 | 130 |
131 IN_PROC_BROWSER_TEST_F(SystemInfoStorageApiTest, StorageAttachment) { | 131 IN_PROC_BROWSER_TEST_F(SystemInfoStorageApiTest, StorageAttachment) { |
(...skipping 16 matching lines...) Expand all Loading... |
148 ASSERT_TRUE(attach_listener.WaitUntilSatisfied()); | 148 ASSERT_TRUE(attach_listener.WaitUntilSatisfied()); |
149 ProcessAttach(kRemovableStorageDeviceId, | 149 ProcessAttach(kRemovableStorageDeviceId, |
150 ASCIIToUTF16(kRemovableStorageDeviceName), | 150 ASCIIToUTF16(kRemovableStorageDeviceName), |
151 kRemovableStorageLocation); | 151 kRemovableStorageLocation); |
152 // Simulate triggering onDetached event. | 152 // Simulate triggering onDetached event. |
153 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); | 153 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); |
154 ProcessDetach(kRemovableStorageDeviceId); | 154 ProcessDetach(kRemovableStorageDeviceId); |
155 | 155 |
156 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 156 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
157 } | 157 } |
OLD | NEW |