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

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

Issue 809713006: Disable new bookmark apps flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix woopsies Created 5 years, 11 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 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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/chrome_content_browser_client.h" 16 #include "chrome/browser/chrome_content_browser_client.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/command_updater.h" 18 #include "chrome/browser/command_updater.h"
19 #include "chrome/browser/defaults.h" 19 #include "chrome/browser/defaults.h"
20 #include "chrome/browser/devtools/devtools_window_testing.h" 20 #include "chrome/browser/devtools/devtools_window_testing.h"
21 #include "chrome/browser/extensions/extension_browsertest.h" 21 #include "chrome/browser/extensions/extension_browsertest.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/extension_util.h"
23 #include "chrome/browser/extensions/tab_helper.h" 24 #include "chrome/browser/extensions/tab_helper.h"
24 #include "chrome/browser/first_run/first_run.h" 25 #include "chrome/browser/first_run/first_run.h"
25 #include "chrome/browser/lifetime/application_lifetime.h" 26 #include "chrome/browser/lifetime/application_lifetime.h"
26 #include "chrome/browser/prefs/incognito_mode_prefs.h" 27 #include "chrome/browser/prefs/incognito_mode_prefs.h"
27 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/profiles/profile_manager.h" 29 #include "chrome/browser/profiles/profile_manager.h"
29 #include "chrome/browser/search/search.h" 30 #include "chrome/browser/search/search.h"
30 #include "chrome/browser/sessions/session_service_factory.h" 31 #include "chrome/browser/sessions/session_service_factory.h"
31 #include "chrome/browser/translate/chrome_translate_client.h" 32 #include "chrome/browser/translate/chrome_translate_client.h"
32 #include "chrome/browser/translate/cld_data_harness.h" 33 #include "chrome/browser/translate/cld_data_harness.h"
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1310 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1310 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); 1311 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
1311 const Extension* extension_app = GetExtension(); 1312 const Extension* extension_app = GetExtension();
1312 1313
1313 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); 1314 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
1314 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 1315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
1315 1316
1316 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 1317 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
1317 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 1318 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
1318 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 1319 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
1319 EXPECT_FALSE(launch.OpenApplicationWindow(browser()->profile(), NULL));
1320 EXPECT_TRUE(launch.OpenApplicationTab(browser()->profile()));
1321 1320
1322 // Check that a new browser wasn't opened. 1321 bool new_bookmark_apps_enabled =
Lei Zhang 2015/01/13 01:34:40 Do you need all the conditionals below that depend
benwells 2015/01/13 03:22:52 I thought it might be better if the test would pas
1323 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 1322 extensions::util::IsStreamlinedHostedAppsEnabled();
1324 browser()->host_desktop_type()));
1325 1323
1326 // Check that a new tab was opened. 1324 // If the new bookmark app flow is enabled, the app should open as an tab.
1327 EXPECT_EQ(2, browser()->tab_strip_model()->count()); 1325 // Otherwise the app should open as an app window.
1326 EXPECT_EQ(!new_bookmark_apps_enabled,
1327 launch.OpenApplicationWindow(browser()->profile(), NULL));
1328 EXPECT_EQ(new_bookmark_apps_enabled,
1329 launch.OpenApplicationTab(browser()->profile()));
1330
1331 // Check that a the number of browsers and tabs is correct.
1332 unsigned int expected_browsers = 1;
1333 int expected_tabs = 1;
1334 new_bookmark_apps_enabled ? expected_tabs++ : expected_browsers++;
1335
1336 EXPECT_EQ(expected_browsers,
1337 chrome::GetBrowserCount(browser()->profile(),
1338 browser()->host_desktop_type()));
1339 EXPECT_EQ(expected_tabs, browser()->tab_strip_model()->count());
1328 } 1340 }
1329 1341
1330 // Open an app window and the dev tools window and ensure that the location 1342 // Open an app window and the dev tools window and ensure that the location
1331 // bar settings are correct. 1343 // bar settings are correct.
1332 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) { 1344 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) {
1333 ASSERT_TRUE(test_server()->Start()); 1345 ASSERT_TRUE(test_server()->Start());
1334 1346
1335 // Load an app. 1347 // Load an app.
1336 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1348 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1337 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); 1349 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/")));
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 #endif 2744 #endif
2733 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2745 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2734 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2746 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2735 gfx::Size exp_final_size(initial_wcv_size); 2747 gfx::Size exp_final_size(initial_wcv_size);
2736 exp_final_size.Enlarge(wcv_resize_insets.width(), 2748 exp_final_size.Enlarge(wcv_resize_insets.width(),
2737 wcv_resize_insets.height() + height_inset); 2749 wcv_resize_insets.height() + height_inset);
2738 EXPECT_EQ(exp_final_size, 2750 EXPECT_EQ(exp_final_size,
2739 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2751 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2740 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2752 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2741 } 2753 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | chrome/browser/ui/startup/startup_browser_creator_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698