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

Side by Side Diff: chrome/browser/browser_uitest.cc

Issue 2847032: Add a simple UI test for --app mode. (Closed)
Patch Set: Fixes Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "base/test/test_file_util.h" 9 #include "base/test/test_file_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
12 #include "chrome/browser/browser.h"
12 #include "chrome/browser/platform_util.h" 13 #include "chrome/browser/platform_util.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/test/automation/browser_proxy.h" 17 #include "chrome/test/automation/browser_proxy.h"
17 #include "chrome/test/automation/tab_proxy.h" 18 #include "chrome/test/automation/tab_proxy.h"
18 #include "chrome/test/automation/window_proxy.h" 19 #include "chrome/test/automation/window_proxy.h"
19 #include "chrome/test/ui/ui_test.h" 20 #include "chrome/test/ui/ui_test.h"
20 #include "gfx/native_widget_types.h" 21 #include "gfx/native_widget_types.h"
21 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 239
239 #if !defined(OS_MACOSX) 240 #if !defined(OS_MACOSX)
240 class KioskModeTest : public UITest { 241 class KioskModeTest : public UITest {
241 public: 242 public:
242 KioskModeTest() { 243 KioskModeTest() {
243 launch_arguments_.AppendSwitch(switches::kKioskMode); 244 launch_arguments_.AppendSwitch(switches::kKioskMode);
244 } 245 }
245 }; 246 };
246 247
247 TEST_F(KioskModeTest, EnableKioskModeTest) { 248 TEST_F(KioskModeTest, EnableKioskModeTest) {
248 // Load a dummy url. 249 // Load a local file.
249 FilePath test_file(test_data_directory_); 250 FilePath test_file(test_data_directory_);
250 test_file = test_file.AppendASCII("title1.html"); 251 test_file = test_file.AppendASCII("title1.html");
251 252
252 // Verify that the window is present. 253 // Verify that the window is present.
253 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 254 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
254 ASSERT_TRUE(browser.get()); 255 ASSERT_TRUE(browser.get());
255 256
256 // Check if browser is in fullscreen mode. 257 // Check if browser is in fullscreen mode.
257 bool is_visible; 258 bool is_visible;
258 ASSERT_TRUE(browser->IsFullscreen(&is_visible)); 259 ASSERT_TRUE(browser->IsFullscreen(&is_visible));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 }; 296 };
296 297
297 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) { 298 TEST_F(LaunchBrowserWithNonAsciiUserDatadir, TestNonAsciiUserDataDir) {
298 ASSERT_TRUE(LaunchAppWithProfile()); 299 ASSERT_TRUE(LaunchAppWithProfile());
299 // Verify that the window is present. 300 // Verify that the window is present.
300 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 301 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
301 ASSERT_TRUE(browser.get()); 302 ASSERT_TRUE(browser.get());
302 } 303 }
303 #endif // defined(OS_WIN) 304 #endif // defined(OS_WIN)
304 305
306 class AppModeTest : public UITest {
307 public:
308 AppModeTest() {
309 // Load a local file.
310 FilePath test_file(test_data_directory_);
311 test_file = test_file.AppendASCII("title1.html");
312 GURL test_file_url(net::FilePathToFileURL(test_file));
313
314 launch_arguments_.AppendSwitchWithValue(switches::kApp,
315 test_file_url.spec());
316 }
317 };
318
319 TEST_F(AppModeTest, EnableAppModeTest) {
320 // Test that an application browser window loads correctly.
321
322 // Verify that the window is present.
323 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
324 ASSERT_TRUE(browser.get());
325
326 // Verify the browser is an application.
327 Browser::Type type;
328 ASSERT_TRUE(browser->GetType(&type));
329 EXPECT_EQ(Browser::TYPE_APP, type);
330 }
331
305 } // namespace 332 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698