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

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

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use singleton instead of browserprocess Created 4 years, 10 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 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 <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
48 #include "extensions/common/extension.h" 48 #include "extensions/common/extension.h"
49 #include "extensions/common/manifest_constants.h" 49 #include "extensions/common/manifest_constants.h"
50 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
51 #include "ui/aura/client/window_tree_client.h" 51 #include "ui/aura/client/window_tree_client.h"
52 #include "ui/base/models/menu_model.h" 52 #include "ui/base/models/menu_model.h"
53 53
54 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
55 #include "ash/test/test_session_state_delegate.h" 55 #include "ash/test/test_session_state_delegate.h"
56 #include "ash/test/test_shell_delegate.h" 56 #include "ash/test/test_shell_delegate.h"
57 #include "chrome/browser/apps/scoped_keep_alive.h"
58 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 57 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
59 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 58 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
60 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 59 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
60 #include "chrome/browser/lifetime/scoped_keep_alive.h"
61 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 61 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
62 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 62 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
63 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 63 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
64 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 64 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
65 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 65 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 66 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
67 #include "chrome/common/chrome_constants.h" 67 #include "chrome/common/chrome_constants.h"
68 #include "chrome/common/chrome_switches.h" 68 #include "chrome/common/chrome_switches.h"
69 #include "chrome/test/base/testing_browser_process.h" 69 #include "chrome/test/base/testing_browser_process.h"
70 #include "chrome/test/base/testing_profile_manager.h" 70 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 722
723 DISALLOW_COPY_AND_ASSIGN(V1App); 723 DISALLOW_COPY_AND_ASSIGN(V1App);
724 }; 724 };
725 725
726 // A V2 application which gets created with an |extension| and for a |profile|. 726 // A V2 application which gets created with an |extension| and for a |profile|.
727 // Upon destruction it will properly close the application. 727 // Upon destruction it will properly close the application.
728 class V2App { 728 class V2App {
729 public: 729 public:
730 V2App(Profile* profile, const extensions::Extension* extension) { 730 V2App(Profile* profile, const extensions::Extension* extension) {
731 window_ = new extensions::AppWindow( 731 window_ = new extensions::AppWindow(
732 profile, 732 profile, new ChromeAppDelegate(
733 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), 733 make_scoped_ptr(new ScopedKeepAlive(ChromeAppDelegate))),
734 extension); 734 extension);
735 extensions::AppWindow::CreateParams params = 735 extensions::AppWindow::CreateParams params =
736 extensions::AppWindow::CreateParams(); 736 extensions::AppWindow::CreateParams();
737 window_->Init(GURL(std::string()), 737 window_->Init(GURL(std::string()),
738 new extensions::AppWindowContentsImpl(window_), params); 738 new extensions::AppWindowContentsImpl(window_), params);
739 } 739 }
740 740
741 virtual ~V2App() { 741 virtual ~V2App() {
742 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); 742 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents());
743 window_->GetBaseWindow()->Close(); 743 window_->GetBaseWindow()->Close();
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 2758
2759 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2759 EXPECT_EQ(1, app_icon_loader->fetch_count());
2760 ASSERT_EQ(initial_size + 1, model_->items().size()); 2760 ASSERT_EQ(initial_size + 1, model_->items().size());
2761 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2761 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2762 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2762 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2763 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2763 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2764 2764
2765 launcher_controller_->UnpinAppWithID("1"); 2765 launcher_controller_->UnpinAppWithID("1");
2766 ASSERT_EQ(initial_size, model_->items().size()); 2766 ASSERT_EQ(initial_size, model_->items().size());
2767 } 2767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698