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

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

Issue 8929027: Follow-up changes to http://codereview.chromium.org/8937001 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disabling the AttemptRestart test on ChromiumOS. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/browser_list_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/first_run/first_run.h" 11 #include "chrome/browser/first_run/first_run.h"
12 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/prefs/session_startup_pref.h" 13 #include "chrome/browser/prefs/session_startup_pref.h"
12 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_init.h" 16 #include "chrome/browser/ui/browser_init.h"
15 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h"
18 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
21 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
22 25
23 class BrowserInitTest : public ExtensionBrowserTest { 26 class BrowserInitTest : public ExtensionBrowserTest {
24 protected: 27 protected:
25 virtual void SetUpCommandLine(CommandLine* command_line) { 28 virtual void SetUpCommandLine(CommandLine* command_line) {
26 ExtensionBrowserTest::SetUpCommandLine(command_line); 29 ExtensionBrowserTest::SetUpCommandLine(command_line);
27 command_line->AppendSwitch(switches::kEnablePanels); 30 command_line->AppendSwitch(switches::kEnablePanels);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 305
303 // Expect an app panel. 306 // Expect an app panel.
304 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); 307 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app());
305 308
306 // The new browser's app_name should include the app's ID. 309 // The new browser's app_name should include the app's ID.
307 EXPECT_NE( 310 EXPECT_NE(
308 new_browser->app_name_.find(extension_app->id()), 311 new_browser->app_name_.find(extension_app->id()),
309 std::string::npos) << new_browser->app_name_; 312 std::string::npos) << new_browser->app_name_;
310 } 313 }
311 314
315 IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterRestart) {
316 // Tests that BrowserInit::WasRestarted reads and resets the preference
317 // kWasRestarted correctly.
318 PrefService* pref_service = g_browser_process->local_state();
319 pref_service->SetBoolean(prefs::kWasRestarted, true);
320 EXPECT_TRUE(BrowserInit::WasRestarted());
321 EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
322 EXPECT_TRUE(BrowserInit::WasRestarted());
323 }
324
325 IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterNormalStart) {
326 // Tests that BrowserInit::WasRestarted reads and resets the preference
327 // kWasRestarted correctly.
328 PrefService* pref_service = g_browser_process->local_state();
329 pref_service->SetBoolean(prefs::kWasRestarted, false);
330 EXPECT_FALSE(BrowserInit::WasRestarted());
331 EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
332 EXPECT_FALSE(BrowserInit::WasRestarted());
333 }
334
312 #endif // !defined(OS_MACOSX) 335 #endif // !defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/browser_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698