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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 772533005: Enable the new bookmark apps system by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update one more test Created 6 years 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 NULL); 1289 NULL);
1290 EXPECT_EQ(1, observer.closing_count()); 1290 EXPECT_EQ(1, observer.closing_count());
1291 1291
1292 model->RemoveObserver(&observer); 1292 model->RemoveObserver(&observer);
1293 1293
1294 // There should only be one tab now. 1294 // There should only be one tab now.
1295 ASSERT_EQ(1, browser()->tab_strip_model()->count()); 1295 ASSERT_EQ(1, browser()->tab_strip_model()->count());
1296 } 1296 }
1297 1297
1298 #if !defined(OS_MACOSX) 1298 #if !defined(OS_MACOSX)
1299 // Open with --app-id=<id>, and see that an app window opens. 1299 // Open with --app-id=<id>, and see that an application tab opens by default.
1300 IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { 1300 IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
1301 ASSERT_TRUE(test_server()->Start()); 1301 ASSERT_TRUE(test_server()->Start());
1302 1302
1303 // There should be one tab to start with.
1304 ASSERT_EQ(1, browser()->tab_strip_model()->count());
1305
1303 // Load an app. 1306 // Load an app.
1304 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1307 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1305 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); 1308 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
1306 const Extension* extension_app = GetExtension(); 1309 const Extension* extension_app = GetExtension();
1307 1310
1308 CommandLine command_line(CommandLine::NO_PROGRAM); 1311 CommandLine command_line(CommandLine::NO_PROGRAM);
1309 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 1312 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
1310 1313
1311 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 1314 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
1312 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 1315 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
1313 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 1316 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
1314 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile(), NULL)); 1317 EXPECT_FALSE(launch.OpenApplicationWindow(browser()->profile(), NULL));
1318 EXPECT_TRUE(launch.OpenApplicationTab(browser()->profile()));
1315 1319
1316 // Check that the new browser has an app name. 1320 // Check that a new browser wasn't opened.
1317 // The launch should have created a new browser. 1321 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
1318 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(),
1319 browser()->host_desktop_type())); 1322 browser()->host_desktop_type()));
1320 1323
1321 // Find the new browser. 1324 // Check that a new tab was opened.
1322 Browser* new_browser = NULL; 1325 EXPECT_EQ(2, browser()->tab_strip_model()->count());
1323 for (chrome::BrowserIterator it; !it.done() && !new_browser; it.Next()) {
1324 if (*it != browser())
1325 new_browser = *it;
1326 }
1327 ASSERT_TRUE(new_browser);
1328 ASSERT_TRUE(new_browser != browser());
1329
1330 // The browser's app_name should include the app's ID.
1331 ASSERT_NE(
1332 new_browser->app_name_.find(extension_app->id()),
1333 std::string::npos) << new_browser->app_name_;
1334 } 1326 }
1335 1327
1336 // Open an app window and the dev tools window and ensure that the location 1328 // Open an app window and the dev tools window and ensure that the location
1337 // bar settings are correct. 1329 // bar settings are correct.
1338 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) { 1330 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) {
1339 ASSERT_TRUE(test_server()->Start()); 1331 ASSERT_TRUE(test_server()->Start());
1340 1332
1341 // Load an app. 1333 // Load an app.
1342 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1334 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1343 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); 1335 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)); 1371 app_browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR));
1380 1372
1381 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); 1373 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window);
1382 } 1374 }
1383 #endif 1375 #endif
1384 1376
1385 // Open a normal browser window, a hosted app window, a legacy packaged app 1377 // Open a normal browser window, a hosted app window, a legacy packaged app
1386 // window and a dev tools window, and check that the web app frame feature is 1378 // window and a dev tools window, and check that the web app frame feature is
1387 // supported correctly. 1379 // supported correctly.
1388 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldUseWebAppFrame) { 1380 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldUseWebAppFrame) {
1389 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1390 switches::kEnableStreamlinedHostedApps);
1391
1392 ASSERT_TRUE(test_server()->Start()); 1381 ASSERT_TRUE(test_server()->Start());
1393 1382
1394 // Load a hosted app. 1383 // Load a hosted app.
1395 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1384 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1396 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); 1385 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
1397 const Extension* hosted_app = GetExtension(); 1386 const Extension* hosted_app = GetExtension();
1398 1387
1399 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. 1388 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would.
1400 WebContents* hosted_app_window = OpenApplication(AppLaunchParams( 1389 WebContents* hosted_app_window = OpenApplication(AppLaunchParams(
1401 browser()->profile(), hosted_app, extensions::LAUNCH_CONTAINER_WINDOW, 1390 browser()->profile(), hosted_app, extensions::LAUNCH_CONTAINER_WINDOW,
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 #endif 2724 #endif
2736 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2725 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2737 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2726 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2738 gfx::Size exp_final_size(initial_wcv_size); 2727 gfx::Size exp_final_size(initial_wcv_size);
2739 exp_final_size.Enlarge(wcv_resize_insets.width(), 2728 exp_final_size.Enlarge(wcv_resize_insets.width(),
2740 wcv_resize_insets.height() + height_inset); 2729 wcv_resize_insets.height() + height_inset);
2741 EXPECT_EQ(exp_final_size, 2730 EXPECT_EQ(exp_final_size,
2742 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2731 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2743 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2732 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2744 } 2733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698