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

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 10834015: Add Startup Timing to CPM (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sky's finds + updates Created 8 years, 4 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 | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/sessions/session_service.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/sessions/session_restore.h" 13 #include "chrome/browser/sessions/session_restore.h"
14 #include "chrome/browser/sessions/session_service.h" 14 #include "chrome/browser/sessions/session_service.h"
15 #include "chrome/browser/sessions/session_service_factory.h" 15 #include "chrome/browser/sessions/session_service_factory.h"
16 #include "chrome/browser/sessions/session_service_test_helper.h"
16 #include "chrome/browser/sessions/tab_restore_service.h" 17 #include "chrome/browser/sessions/tab_restore_service.h"
17 #include "chrome/browser/sessions/tab_restore_service_factory.h" 18 #include "chrome/browser/sessions/tab_restore_service_factory.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_commands.h" 20 #include "chrome/browser/ui/browser_commands.h"
20 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/browser_tabstrip.h" 22 #include "chrome/browser/ui/browser_tabstrip.h"
22 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
(...skipping 18 matching lines...) Expand all
44 45
45 virtual void SetUpOnMainThread() OVERRIDE { 46 virtual void SetUpOnMainThread() OVERRIDE {
46 SessionStartupPref pref(SessionStartupPref::LAST); 47 SessionStartupPref pref(SessionStartupPref::LAST);
47 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 48 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
48 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) 49 #if defined(OS_CHROMEOS) || defined(OS_MACOSX)
49 const testing::TestInfo* const test_info = 50 const testing::TestInfo* const test_info =
50 testing::UnitTest::GetInstance()->current_test_info(); 51 testing::UnitTest::GetInstance()->current_test_info();
51 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) { 52 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS")) {
52 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we 53 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we
53 // can get these test to work without quitting. 54 // can get these test to work without quitting.
54 SessionServiceFactory::GetForProfile(browser()->profile())-> 55 // SessionServiceFactory::GetForProfile(browser()->profile())->
sky 2012/08/07 23:19:12 remove these two lines.
55 force_browser_not_alive_with_no_windows_ = true; 56 // force_browser_not_alive_with_no_windows_ = true;
57 SessionServiceTestHelper helper(
58 SessionServiceFactory::GetForProfile(browser()->profile()));
59 helper.SetForceBrowserNotAliveWithNoWindows(true);
60 helper.ReleaseService();
56 } 61 }
57 #endif 62 #endif
58 } 63 }
59 64
60 virtual bool SetUpUserDataDirectory() OVERRIDE { 65 virtual bool SetUpUserDataDirectory() OVERRIDE {
61 // Make sure the first run sentinel file exists before running these tests, 66 // Make sure the first run sentinel file exists before running these tests,
62 // since some of them customize the session startup pref whose value can 67 // since some of them customize the session startup pref whose value can
63 // be different than the default during the first run. 68 // be different than the default during the first run.
64 // TODO(bauerb): set the first run flag instead of creating a sentinel file. 69 // TODO(bauerb): set the first run flag instead of creating a sentinel file.
65 first_run::CreateSentinel(); 70 first_run::CreateSentinel();
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 ASSERT_EQ(1u, BrowserList::size()); 785 ASSERT_EQ(1u, BrowserList::size());
781 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL()); 786 ASSERT_EQ(url1_, chrome::GetActiveWebContents(new_browser)->GetURL());
782 const content::NavigationController& new_controller = 787 const content::NavigationController& new_controller =
783 chrome::GetActiveWebContents(new_browser)->GetController(); 788 chrome::GetActiveWebContents(new_browser)->GetController();
784 ASSERT_TRUE(new_controller.GetSessionStorageNamespace()); 789 ASSERT_TRUE(new_controller.GetSessionStorageNamespace());
785 std::string restored_session_storage_persistent_id = 790 std::string restored_session_storage_persistent_id =
786 new_controller.GetSessionStorageNamespace()->persistent_id(); 791 new_controller.GetSessionStorageNamespace()->persistent_id();
787 EXPECT_EQ(session_storage_persistent_id, 792 EXPECT_EQ(session_storage_persistent_id,
788 restored_session_storage_persistent_id); 793 restored_session_storage_persistent_id);
789 } 794 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698