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

Side by Side Diff: chrome/browser/managed_mode_unittest.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 (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 #include "chrome/browser/managed_mode.h" 5 #include "chrome/browser/managed_mode.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return true; 58 return true;
59 } 59 }
60 60
61 private: 61 private:
62 bool in_managed_mode_; 62 bool in_managed_mode_;
63 bool should_cancel_enter_; 63 bool should_cancel_enter_;
64 }; 64 };
65 65
66 class MockBrowserWindow : public TestBrowserWindow { 66 class MockBrowserWindow : public TestBrowserWindow {
67 public: 67 public:
68 explicit MockBrowserWindow(Browser* browser) : TestBrowserWindow(browser) {
69 }
70
71 MOCK_METHOD0(Close, void()); 68 MOCK_METHOD0(Close, void());
72 }; 69 };
73 70
74 class BrowserFixture { 71 class BrowserFixture {
75 public: 72 public:
76 BrowserFixture(FakeManagedMode* managed_mode, 73 BrowserFixture(FakeManagedMode* managed_mode,
77 TestingProfile* profile) 74 TestingProfile* profile) {
78 : browser_(Browser::TYPE_TABBED, profile), 75 Browser::CreateParams params(profile);
79 window_(&browser_) { 76 params.window = &window_;
80 browser_.SetWindowForTesting(&window_); 77 browser_.reset(new Browser(params));
81 } 78 }
82 79
83 ~BrowserFixture() { 80 ~BrowserFixture() {
84 } 81 }
85 82
86 MockBrowserWindow* window() { 83 MockBrowserWindow* window() {
87 return &window_; 84 return &window_;
88 } 85 }
89 86
90 private: 87 private:
91 Browser browser_; 88 scoped_ptr<Browser> browser_;
92 StrictMock<MockBrowserWindow> window_; 89 StrictMock<MockBrowserWindow> window_;
93 }; 90 };
94 91
95 class MockCallback : public base::RefCountedThreadSafe<MockCallback> { 92 class MockCallback : public base::RefCountedThreadSafe<MockCallback> {
96 public: 93 public:
97 explicit MockCallback(FakeManagedMode* managed_mode) 94 explicit MockCallback(FakeManagedMode* managed_mode)
98 : managed_mode_(managed_mode) { 95 : managed_mode_(managed_mode) {
99 } 96 }
100 97
101 void CheckManagedMode(bool success) { 98 void CheckManagedMode(bool success) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 EXPECT_TRUE(managed_mode_.UserMayModifySettings(NULL, NULL)); 238 EXPECT_TRUE(managed_mode_.UserMayModifySettings(NULL, NULL));
242 239
243 managed_mode_.SetInManagedMode(&managed_mode_profile_); 240 managed_mode_.SetInManagedMode(&managed_mode_profile_);
244 EXPECT_FALSE(managed_mode_.UserMayLoad(NULL, NULL)); 241 EXPECT_FALSE(managed_mode_.UserMayLoad(NULL, NULL));
245 EXPECT_FALSE(managed_mode_.UserMayModifySettings(NULL, NULL)); 242 EXPECT_FALSE(managed_mode_.UserMayModifySettings(NULL, NULL));
246 243
247 #ifndef NDEBUG 244 #ifndef NDEBUG
248 EXPECT_FALSE(managed_mode_.GetDebugPolicyProviderName().empty()); 245 EXPECT_FALSE(managed_mode_.GetDebugPolicyProviderName().empty());
249 #endif 246 #endif
250 } 247 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.cc ('k') | chrome/browser/notifications/notification_options_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698