| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 #if !defined(OS_CHROMEOS) | 160 #if !defined(OS_CHROMEOS) |
| 161 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplay) { | 161 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplay) { |
| 162 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function( | 162 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function( |
| 163 new SystemDisplaySetDisplayPropertiesFunction()); | 163 new SystemDisplaySetDisplayPropertiesFunction()); |
| 164 | 164 |
| 165 set_info_function->set_has_callback(true); | 165 set_info_function->set_has_callback(true); |
| 166 | 166 |
| 167 EXPECT_EQ( | 167 EXPECT_EQ( |
| 168 "Function available only on ChromeOS.", | 168 SystemDisplayFunction::kCrosOnlyError, |
| 169 api_test_utils::RunFunctionAndReturnError( | 169 api_test_utils::RunFunctionAndReturnError( |
| 170 set_info_function.get(), "[\"display_id\", {}]", browser_context())); | 170 set_info_function.get(), "[\"display_id\", {}]", browser_context())); |
| 171 | 171 |
| 172 std::unique_ptr<base::DictionaryValue> set_info = | 172 std::unique_ptr<base::DictionaryValue> set_info = |
| 173 provider_->GetSetInfoValue(); | 173 provider_->GetSetInfoValue(); |
| 174 EXPECT_FALSE(set_info); | 174 EXPECT_FALSE(set_info); |
| 175 } | 175 } |
| 176 #endif // !defined(OS_CHROMEOS) | 176 #endif // !defined(OS_CHROMEOS) |
| 177 | 177 |
| 178 #if defined(OS_CHROMEOS) | 178 #if defined(OS_CHROMEOS) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 190 scoped_refptr<Extension> test_extension( | 190 scoped_refptr<Extension> test_extension( |
| 191 api_test_utils::CreateExtension(test_extension_value.get())); | 191 api_test_utils::CreateExtension(test_extension_value.get())); |
| 192 | 192 |
| 193 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function( | 193 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function( |
| 194 new SystemDisplaySetDisplayPropertiesFunction()); | 194 new SystemDisplaySetDisplayPropertiesFunction()); |
| 195 | 195 |
| 196 set_info_function->set_extension(test_extension.get()); | 196 set_info_function->set_extension(test_extension.get()); |
| 197 set_info_function->set_has_callback(true); | 197 set_info_function->set_has_callback(true); |
| 198 | 198 |
| 199 EXPECT_EQ( | 199 EXPECT_EQ( |
| 200 "The extension needs to be kiosk enabled to use the function.", | 200 SystemDisplayFunction::kKioskOnlyError, |
| 201 api_test_utils::RunFunctionAndReturnError( | 201 api_test_utils::RunFunctionAndReturnError( |
| 202 set_info_function.get(), "[\"display_id\", {}]", browser_context())); | 202 set_info_function.get(), "[\"display_id\", {}]", browser_context())); |
| 203 | 203 |
| 204 std::unique_ptr<base::DictionaryValue> set_info = | 204 std::unique_ptr<base::DictionaryValue> set_info = |
| 205 provider_->GetSetInfoValue(); | 205 provider_->GetSetInfoValue(); |
| 206 EXPECT_FALSE(set_info); | 206 EXPECT_FALSE(set_info); |
| 207 } | 207 } |
| 208 | 208 |
| 209 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayKioskEnabled) { | 209 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayKioskEnabled) { |
| 210 std::unique_ptr<base::DictionaryValue> test_extension_value( | 210 std::unique_ptr<base::DictionaryValue> test_extension_value( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, EnableUnifiedDesktop) { | 261 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, EnableUnifiedDesktop) { |
| 262 std::unique_ptr<base::DictionaryValue> test_extension_value( | 262 std::unique_ptr<base::DictionaryValue> test_extension_value( |
| 263 api_test_utils::ParseDictionary("{\n" | 263 api_test_utils::ParseDictionary("{\n" |
| 264 " \"name\": \"Test\",\n" | 264 " \"name\": \"Test\",\n" |
| 265 " \"version\": \"1.0\",\n" | 265 " \"version\": \"1.0\",\n" |
| 266 " \"app\": {\n" | 266 " \"app\": {\n" |
| 267 " \"background\": {\n" | 267 " \"background\": {\n" |
| 268 " \"scripts\": [\"background.js\"]\n" | 268 " \"scripts\": [\"background.js\"]\n" |
| 269 " }\n" | 269 " }\n" |
| 270 " }\n" | 270 " },\n" |
| 271 " \"kiosk_enabled\": true\n" |
| 271 "}")); | 272 "}")); |
| 272 scoped_refptr<Extension> test_extension( | 273 scoped_refptr<Extension> test_extension( |
| 273 api_test_utils::CreateExtension(test_extension_value.get())); | 274 api_test_utils::CreateExtension(test_extension_value.get())); |
| 274 { | 275 { |
| 275 scoped_refptr<SystemDisplayEnableUnifiedDesktopFunction> | 276 scoped_refptr<SystemDisplayEnableUnifiedDesktopFunction> |
| 276 enable_unified_function( | 277 enable_unified_function( |
| 277 new SystemDisplayEnableUnifiedDesktopFunction()); | 278 new SystemDisplayEnableUnifiedDesktopFunction()); |
| 278 | 279 |
| 279 enable_unified_function->set_has_callback(true); | 280 enable_unified_function->set_has_callback(true); |
| 280 enable_unified_function->set_extension(test_extension.get()); | 281 enable_unified_function->set_extension(test_extension.get()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 294 enable_unified_function->set_extension(test_extension.get()); | 295 enable_unified_function->set_extension(test_extension.get()); |
| 295 ASSERT_TRUE(api_test_utils::RunFunction(enable_unified_function.get(), | 296 ASSERT_TRUE(api_test_utils::RunFunction(enable_unified_function.get(), |
| 296 "[false]", browser_context())); | 297 "[false]", browser_context())); |
| 297 EXPECT_FALSE(provider_->unified_desktop_enabled()); | 298 EXPECT_FALSE(provider_->unified_desktop_enabled()); |
| 298 } | 299 } |
| 299 } | 300 } |
| 300 | 301 |
| 301 #endif // defined(OS_CHROMEOS) | 302 #endif // defined(OS_CHROMEOS) |
| 302 | 303 |
| 303 } // namespace extensions | 304 } // namespace extensions |
| OLD | NEW |