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

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

Issue 557833007: Remove Increment/DecrementKeepAliveCount from AppsClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass ScopedKeepAlive Created 6 years, 3 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 <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"
52 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 53 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
53 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 54 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
54 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 55 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
55 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 56 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
56 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 57 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
57 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 58 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
58 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 59 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
59 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
60 #include "chrome/common/chrome_constants.h" 61 #include "chrome/common/chrome_constants.h"
61 #include "chrome/common/chrome_switches.h" 62 #include "chrome/common/chrome_switches.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 scoped_ptr<aura::Window> native_window_; 736 scoped_ptr<aura::Window> native_window_;
736 737
737 DISALLOW_COPY_AND_ASSIGN(V1App); 738 DISALLOW_COPY_AND_ASSIGN(V1App);
738 }; 739 };
739 740
740 // A V2 application which gets created with an |extension| and for a |profile|. 741 // A V2 application which gets created with an |extension| and for a |profile|.
741 // Upon destruction it will properly close the application. 742 // Upon destruction it will properly close the application.
742 class V2App { 743 class V2App {
743 public: 744 public:
744 V2App(Profile* profile, const extensions::Extension* extension) { 745 V2App(Profile* profile, const extensions::Extension* extension) {
745 window_ = new extensions::AppWindow(profile, new ChromeAppDelegate(), 746 window_ = new extensions::AppWindow(
746 extension); 747 profile, new ChromeAppDelegate(scoped_ptr<ScopedKeepAlive>()),
tapted 2014/09/24 07:12:41 this should pass a KeepAlive too (also nit: 1 arg
hashimoto 2014/09/24 09:03:46 Done.
748 extension);
747 extensions::AppWindow::CreateParams params = 749 extensions::AppWindow::CreateParams params =
748 extensions::AppWindow::CreateParams(); 750 extensions::AppWindow::CreateParams();
749 window_->Init(GURL(std::string()), 751 window_->Init(GURL(std::string()),
750 new extensions::AppWindowContentsImpl(window_), params); 752 new extensions::AppWindowContentsImpl(window_), params);
751 } 753 }
752 754
753 virtual ~V2App() { 755 virtual ~V2App() {
754 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); 756 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents());
755 window_->GetBaseWindow()->Close(); 757 window_->GetBaseWindow()->Close();
756 destroyed_watcher.Wait(); 758 destroyed_watcher.Wait();
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 2685
2684 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2686 EXPECT_EQ(1, app_icon_loader->fetch_count());
2685 ASSERT_EQ(initial_size + 1, model_->items().size()); 2687 ASSERT_EQ(initial_size + 1, model_->items().size());
2686 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2688 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2687 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2689 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2688 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2690 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2689 2691
2690 launcher_controller_->UnpinAppWithID("1"); 2692 launcher_controller_->UnpinAppWithID("1");
2691 ASSERT_EQ(initial_size, model_->items().size()); 2693 ASSERT_EQ(initial_size, model_->items().size());
2692 } 2694 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698