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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc

Issue 1376063005: Cleanup: Pull some browser keep alive functions into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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/ui/ash/ash_init.cc ('k') | chrome/browser/ui/browser.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
43 #include "extensions/common/extension.h" 43 #include "extensions/common/extension.h"
44 #include "extensions/common/manifest_constants.h" 44 #include "extensions/common/manifest_constants.h"
45 #include "testing/gtest/include/gtest/gtest.h" 45 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/aura/client/window_tree_client.h" 46 #include "ui/aura/client/window_tree_client.h"
47 #include "ui/base/models/menu_model.h" 47 #include "ui/base/models/menu_model.h"
48 48
49 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
50 #include "ash/test/test_session_state_delegate.h" 50 #include "ash/test/test_session_state_delegate.h"
51 #include "ash/test/test_shell_delegate.h" 51 #include "ash/test/test_shell_delegate.h"
52 #include "chrome/browser/apps/scoped_keep_alive.h"
53 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 52 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
54 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 53 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
55 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 54 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
55 #include "chrome/browser/lifetime/browser_keep_alive.h"
56 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
62 #include "chrome/common/chrome_constants.h" 62 #include "chrome/common/chrome_constants.h"
63 #include "chrome/common/chrome_switches.h" 63 #include "chrome/common/chrome_switches.h"
64 #include "chrome/test/base/testing_browser_process.h" 64 #include "chrome/test/base/testing_browser_process.h"
65 #include "chrome/test/base/testing_profile_manager.h" 65 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 721
722 DISALLOW_COPY_AND_ASSIGN(V1App); 722 DISALLOW_COPY_AND_ASSIGN(V1App);
723 }; 723 };
724 724
725 // A V2 application which gets created with an |extension| and for a |profile|. 725 // A V2 application which gets created with an |extension| and for a |profile|.
726 // Upon destruction it will properly close the application. 726 // Upon destruction it will properly close the application.
727 class V2App { 727 class V2App {
728 public: 728 public:
729 V2App(Profile* profile, const extensions::Extension* extension) { 729 V2App(Profile* profile, const extensions::Extension* extension) {
730 window_ = new extensions::AppWindow( 730 window_ = new extensions::AppWindow(
731 profile, 731 profile, new ChromeAppDelegate(
732 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), 732 make_scoped_ptr(new browser_lifetime::ScopedKeepAlive)),
733 extension); 733 extension);
734 extensions::AppWindow::CreateParams params = 734 extensions::AppWindow::CreateParams params =
735 extensions::AppWindow::CreateParams(); 735 extensions::AppWindow::CreateParams();
736 window_->Init(GURL(std::string()), 736 window_->Init(GURL(std::string()),
737 new extensions::AppWindowContentsImpl(window_), params); 737 new extensions::AppWindowContentsImpl(window_), params);
738 } 738 }
739 739
740 virtual ~V2App() { 740 virtual ~V2App() {
741 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); 741 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents());
742 window_->GetBaseWindow()->Close(); 742 window_->GetBaseWindow()->Close();
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 2673
2674 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2674 EXPECT_EQ(1, app_icon_loader->fetch_count());
2675 ASSERT_EQ(initial_size + 1, model_->items().size()); 2675 ASSERT_EQ(initial_size + 1, model_->items().size());
2676 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2676 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2677 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2677 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2678 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2678 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2679 2679
2680 launcher_controller_->UnpinAppWithID("1"); 2680 launcher_controller_->UnpinAppWithID("1");
2681 ASSERT_EQ(initial_size, model_->items().size()); 2681 ASSERT_EQ(initial_size, model_->items().size());
2682 } 2682 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698