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

Side by Side Diff: extensions/browser/api/system_display/system_display_apitest.cc

Issue 2072633002: Add Get/SetDisplayLayout to chrome.system.display extension API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win Created 4 years, 6 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
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 protected: 148 protected:
149 std::unique_ptr<MockDisplayInfoProvider> provider_; 149 std::unique_ptr<MockDisplayInfoProvider> provider_;
150 std::unique_ptr<display::Screen> screen_; 150 std::unique_ptr<display::Screen> screen_;
151 151
152 private: 152 private:
153 DISALLOW_COPY_AND_ASSIGN(SystemDisplayApiTest); 153 DISALLOW_COPY_AND_ASSIGN(SystemDisplayApiTest);
154 }; 154 };
155 155
156 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, GetDisplay) { 156 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, GetDisplayInfo) {
157 ASSERT_TRUE(RunAppTest("system/display")) << message_; 157 ASSERT_TRUE(RunAppTest("system/display/info")) << message_;
158 } 158 }
159 159
160 #if !defined(OS_CHROMEOS) 160 #if !defined(OS_CHROMEOS)
161
161 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplay) { 162 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplay) {
162 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function( 163 scoped_refptr<SystemDisplaySetDisplayPropertiesFunction> set_info_function(
163 new SystemDisplaySetDisplayPropertiesFunction()); 164 new SystemDisplaySetDisplayPropertiesFunction());
164 165
165 set_info_function->set_has_callback(true); 166 set_info_function->set_has_callback(true);
166 167
167 EXPECT_EQ( 168 EXPECT_EQ(
168 SystemDisplayFunction::kCrosOnlyError, 169 SystemDisplayFunction::kCrosOnlyError,
169 api_test_utils::RunFunctionAndReturnError( 170 api_test_utils::RunFunctionAndReturnError(
170 set_info_function.get(), "[\"display_id\", {}]", browser_context())); 171 set_info_function.get(), "[\"display_id\", {}]", browser_context()));
171 172
172 std::unique_ptr<base::DictionaryValue> set_info = 173 std::unique_ptr<base::DictionaryValue> set_info =
173 provider_->GetSetInfoValue(); 174 provider_->GetSetInfoValue();
174 EXPECT_FALSE(set_info); 175 EXPECT_FALSE(set_info);
175 } 176 }
176 #endif // !defined(OS_CHROMEOS)
177 177
178 #if defined(OS_CHROMEOS) 178 #else // !defined(OS_CHROMEOS)
179
180 // TODO(stevenjb): Add API tests for {GS}etDisplayLayout. That code currently
181 // lives in src/chrome but should be getting moved soon.
182
179 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayNotKioskEnabled) { 183 IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayNotKioskEnabled) {
180 std::unique_ptr<base::DictionaryValue> test_extension_value( 184 std::unique_ptr<base::DictionaryValue> test_extension_value(
181 api_test_utils::ParseDictionary("{\n" 185 api_test_utils::ParseDictionary("{\n"
182 " \"name\": \"Test\",\n" 186 " \"name\": \"Test\",\n"
183 " \"version\": \"1.0\",\n" 187 " \"version\": \"1.0\",\n"
184 " \"app\": {\n" 188 " \"app\": {\n"
185 " \"background\": {\n" 189 " \"background\": {\n"
186 " \"scripts\": [\"background.js\"]\n" 190 " \"scripts\": [\"background.js\"]\n"
187 " }\n" 191 " }\n"
188 " }\n" 192 " }\n"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 new SystemDisplayEnableUnifiedDesktopFunction()); 296 new SystemDisplayEnableUnifiedDesktopFunction());
293 297
294 enable_unified_function->set_has_callback(true); 298 enable_unified_function->set_has_callback(true);
295 enable_unified_function->set_extension(test_extension.get()); 299 enable_unified_function->set_extension(test_extension.get());
296 ASSERT_TRUE(api_test_utils::RunFunction(enable_unified_function.get(), 300 ASSERT_TRUE(api_test_utils::RunFunction(enable_unified_function.get(),
297 "[false]", browser_context())); 301 "[false]", browser_context()));
298 EXPECT_FALSE(provider_->unified_desktop_enabled()); 302 EXPECT_FALSE(provider_->unified_desktop_enabled());
299 } 303 }
300 } 304 }
301 305
302 #endif // defined(OS_CHROMEOS) 306 #endif // !defined(OS_CHROMEOS)
303 307
304 } // namespace extensions 308 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_display/system_display_api.cc ('k') | extensions/browser/extension_function_histogram_value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698