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

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

Issue 280863002: Reduce creation of ViewsDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add widget includes for undef CreateWindow Created 6 years, 7 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 | Annotate | Revision Log
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
11 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/shelf/shelf_item_delegate_manager.h" 12 #include "ash/shelf/shelf_item_delegate_manager.h"
13 #include "ash/shelf/shelf_model.h" 13 #include "ash/shelf/shelf_model.h"
14 #include "ash/shelf/shelf_model_observer.h" 14 #include "ash/shelf/shelf_model_observer.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/test/shelf_item_delegate_manager_test_api.h" 16 #include "ash/test/shelf_item_delegate_manager_test_api.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
19 #include "base/files/file_path.h" 19 #include "base/files/file_path.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
25 #include "chrome/browser/extensions/test_extension_system.h" 25 #include "chrome/browser/extensions/test_extension_system.h"
26 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 26 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
27 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" 27 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h"
28 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" 28 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h"
29 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 29 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
30 #include "chrome/browser/ui/ash/test_views_delegate_with_parent.h"
31 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_commands.h" 31 #include "chrome/browser/ui/browser_commands.h"
33 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
34 #include "chrome/browser/ui/browser_list.h" 33 #include "chrome/browser/ui/browser_list.h"
35 #include "chrome/browser/ui/browser_tabstrip.h" 34 #include "chrome/browser/ui/browser_tabstrip.h"
36 #include "chrome/browser/ui/host_desktop.h" 35 #include "chrome/browser/ui/host_desktop.h"
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
38 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
39 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
40 #include "chrome/test/base/browser_with_test_window_test.h" 39 #include "chrome/test/base/browser_with_test_window_test.h"
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 return CreateMultiUserProfile("user1"); 914 return CreateMultiUserProfile("user1");
916 } 915 }
917 virtual void DestroyProfile(TestingProfile* profile) OVERRIDE { 916 virtual void DestroyProfile(TestingProfile* profile) OVERRIDE {
918 // Delete the profile through our profile manager. 917 // Delete the profile through our profile manager.
919 ProfileToNameMap::iterator it = created_profiles_.find(profile); 918 ProfileToNameMap::iterator it = created_profiles_.find(profile);
920 DCHECK(it != created_profiles_.end()); 919 DCHECK(it != created_profiles_.end());
921 profile_manager_->DeleteTestingProfile(it->second); 920 profile_manager_->DeleteTestingProfile(it->second);
922 created_profiles_.erase(it); 921 created_profiles_.erase(it);
923 } 922 }
924 923
925 virtual views::ViewsDelegate* CreateViewsDelegate() OVERRIDE {
926 return new TestViewsDelegateWithParent;
927 }
928
929 private: 924 private:
930 typedef std::map<Profile*, std::string> ProfileToNameMap; 925 typedef std::map<Profile*, std::string> ProfileToNameMap;
931 TestingProfileManager* profile_manager() { return profile_manager_.get(); } 926 TestingProfileManager* profile_manager() { return profile_manager_.get(); }
932 927
933 chromeos::FakeUserManager* GetFakeUserManager() { 928 chromeos::FakeUserManager* GetFakeUserManager() {
934 return static_cast<chromeos::FakeUserManager*>( 929 return static_cast<chromeos::FakeUserManager*>(
935 chromeos::UserManager::Get()); 930 chromeos::UserManager::Get());
936 } 931 }
937 932
938 scoped_ptr<TestingProfileManager> profile_manager_; 933 scoped_ptr<TestingProfileManager> profile_manager_;
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 2693
2699 EXPECT_EQ(1, app_icon_loader->fetch_count()); 2694 EXPECT_EQ(1, app_icon_loader->fetch_count());
2700 ASSERT_EQ(initial_size + 1, model_->items().size()); 2695 ASSERT_EQ(initial_size + 1, model_->items().size());
2701 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); 2696 EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
2702 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); 2697 EXPECT_FALSE(launcher_controller_->IsAppPinned("0"));
2703 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); 2698 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type);
2704 2699
2705 launcher_controller_->UnpinAppWithID("1"); 2700 launcher_controller_->UnpinAppWithID("1");
2706 ASSERT_EQ(initial_size, model_->items().size()); 2701 ASSERT_EQ(initial_size, model_->items().size());
2707 } 2702 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_error_notifier_ash_unittest.cc ('k') | chrome/browser/ui/ash/test_views_delegate_with_parent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698