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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_unittest.mm

Issue 809313009: Make the SigninErrorController a PKS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copyrighted: 2015 Created 5 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/signin/fake_signin_manager.h" 14 #include "chrome/browser/signin/fake_signin_manager.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 15 #include "chrome/browser/signin/signin_error_controller_factory.h"
16 #include "chrome/browser/signin/signin_manager_factory.h" 16 #include "chrome/browser/signin/signin_manager_factory.h"
17 #include "chrome/browser/sync/profile_sync_service.h" 17 #include "chrome/browser/sync/profile_sync_service.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/browser/sync/profile_sync_service_mock.h" 19 #include "chrome/browser/sync/profile_sync_service_mock.h"
20 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 22 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
23 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 23 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
24 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 24 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
25 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 25 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
26 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 26 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
27 #include "chrome/browser/ui/host_desktop.h" 27 #include "chrome/browser/ui/host_desktop.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/grit/chromium_strings.h" 29 #include "chrome/grit/chromium_strings.h"
30 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
31 #include "chrome/test/base/testing_profile.h" 31 #include "chrome/test/base/testing_profile.h"
32 #include "components/signin/core/browser/fake_auth_status_provider.h" 32 #include "components/signin/core/browser/fake_auth_status_provider.h"
33 #include "components/signin/core/browser/profile_oauth2_token_service.h"
34 #include "components/signin/core/browser/signin_error_controller.h" 33 #include "components/signin/core/browser/signin_error_controller.h"
35 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
36 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
37 #include "content/public/test/test_utils.h" 36 #include "content/public/test/test_utils.h"
38 #include "testing/gmock/include/gmock/gmock.h" 37 #include "testing/gmock/include/gmock/gmock.h"
39 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
40 #include "ui/base/l10n/l10n_util_mac.h" 39 #include "ui/base/l10n/l10n_util_mac.h"
41 40
42 using ::testing::Return; 41 using ::testing::Return;
43 42
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 730
732 // Now sign in. 731 // Now sign in.
733 std::string username = "foo@example.com"; 732 std::string username = "foo@example.com";
734 SigninManager* signin = SigninManagerFactory::GetForProfile(profile()); 733 SigninManager* signin = SigninManagerFactory::GetForProfile(profile());
735 signin->SetAuthenticatedUsername(username); 734 signin->SetAuthenticatedUsername(username);
736 ProfileSyncService* sync = 735 ProfileSyncService* sync =
737 ProfileSyncServiceFactory::GetForProfile(profile()); 736 ProfileSyncServiceFactory::GetForProfile(profile());
738 sync->SetSyncSetupCompleted(); 737 sync->SetSyncSetupCompleted();
739 // Force an auth error. 738 // Force an auth error.
740 FakeAuthStatusProvider provider( 739 FakeAuthStatusProvider provider(
741 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())-> 740 SigninErrorControllerFactory::GetForProfile(profile()));;
742 signin_error_controller());
743 GoogleServiceAuthError error( 741 GoogleServiceAuthError error(
744 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 742 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
745 provider.SetAuthError("user@gmail.com", "user@gmail.com", error); 743 provider.SetAuthError("user@gmail.com", "user@gmail.com", error);
746 [BrowserWindowController updateSigninItem:syncMenuItem 744 [BrowserWindowController updateSigninItem:syncMenuItem
747 shouldShow:YES 745 shouldShow:YES
748 currentProfile:profile()]; 746 currentProfile:profile()];
749 NSString* authError = 747 NSString* authError =
750 l10n_util::GetNSStringWithFixup(IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM); 748 l10n_util::GetNSStringWithFixup(IDS_SYNC_SIGN_IN_ERROR_WRENCH_MENU_ITEM);
751 EXPECT_TRUE([[syncMenuItem title] isEqualTo:authError]); 749 EXPECT_TRUE([[syncMenuItem title] isEqualTo:authError]);
752 EXPECT_FALSE([syncMenuItem isHidden]); 750 EXPECT_FALSE([syncMenuItem isHidden]);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 928 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
931 styleMask:NSBorderlessWindowMask 929 styleMask:NSBorderlessWindowMask
932 backing:NSBackingStoreBuffered 930 backing:NSBackingStoreBuffered
933 defer:NO]); 931 defer:NO]);
934 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; 932 [[testFullscreenWindow_ contentView] setWantsLayer:YES];
935 return testFullscreenWindow_.get(); 933 return testFullscreenWindow_.get();
936 } 934 }
937 @end 935 @end
938 936
939 /* TODO(???): test other methods of BrowserWindowController */ 937 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698