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

Side by Side Diff: chrome/browser/ui/browser_unittest.cc

Issue 9702055: Automated tests for full screen & mouse lock M16 features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Valgrind error fix, merge to 130358 Created 8 years, 8 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include "chrome/test/base/browser_with_test_window_test.h" 7 #include "chrome/test/base/browser_with_test_window_test.h"
8 #include "content/public/browser/render_process_host.h" 8 #include "content/public/browser/render_process_host.h"
9 #include "content/public/browser/site_instance.h" 9 #include "content/public/browser/site_instance.h"
10 10
11 typedef BrowserWithTestWindowTest BrowserTest;
12
13 class TestingOffTheRecordDestructionProfile : public TestingProfile { 11 class TestingOffTheRecordDestructionProfile : public TestingProfile {
14 public: 12 public:
15 TestingOffTheRecordDestructionProfile() : destroyed_profile_(false) { 13 TestingOffTheRecordDestructionProfile() : destroyed_profile_(false) {
16 set_incognito(true); 14 set_incognito(true);
17 } 15 }
18 virtual void DestroyOffTheRecordProfile() OVERRIDE { 16 virtual void DestroyOffTheRecordProfile() OVERRIDE {
19 destroyed_profile_ = true; 17 destroyed_profile_ = true;
20 } 18 }
21 bool destroyed_profile_; 19 bool destroyed_profile_;
22 20
23 DISALLOW_COPY_AND_ASSIGN(TestingOffTheRecordDestructionProfile); 21 DISALLOW_COPY_AND_ASSIGN(TestingOffTheRecordDestructionProfile);
24 }; 22 };
25 23
26 class BrowserTestOffTheRecord : public BrowserTest { 24 class BrowserTestOffTheRecord : public BrowserWithTestWindowTest {
27 public: 25 public:
28 BrowserTestOffTheRecord() : off_the_record_profile_(NULL) {} 26 BrowserTestOffTheRecord() : off_the_record_profile_(NULL) {}
29 27
30 protected: 28 protected:
31 virtual TestingProfile* CreateProfile() OVERRIDE { 29 virtual TestingProfile* CreateProfile() OVERRIDE {
32 if (off_the_record_profile_ == NULL) 30 if (off_the_record_profile_ == NULL)
33 off_the_record_profile_ = new TestingOffTheRecordDestructionProfile(); 31 off_the_record_profile_ = new TestingOffTheRecordDestructionProfile();
34 return off_the_record_profile_; 32 return off_the_record_profile_;
35 } 33 }
36 TestingOffTheRecordDestructionProfile* off_the_record_profile_; 34 TestingOffTheRecordDestructionProfile* off_the_record_profile_;
37 35
38 DISALLOW_COPY_AND_ASSIGN(BrowserTestOffTheRecord); 36 DISALLOW_COPY_AND_ASSIGN(BrowserTestOffTheRecord);
39 }; 37 };
40 38
41 // Various assertions around setting show state. 39 // Various assertions around setting show state.
42 TEST_F(BrowserTest, GetSavedWindowShowState) { 40 TEST_F(BrowserWithTestWindowTest, GetSavedWindowShowState) {
43 // Default show state is SHOW_STATE_DEFAULT. 41 // Default show state is SHOW_STATE_DEFAULT.
44 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, browser()->GetSavedWindowShowState()); 42 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, browser()->GetSavedWindowShowState());
45 43
46 // Explicitly specifying a state should stick though. 44 // Explicitly specifying a state should stick though.
47 browser()->set_show_state(ui::SHOW_STATE_MAXIMIZED); 45 browser()->set_show_state(ui::SHOW_STATE_MAXIMIZED);
48 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, browser()->GetSavedWindowShowState()); 46 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, browser()->GetSavedWindowShowState());
49 browser()->set_show_state(ui::SHOW_STATE_NORMAL); 47 browser()->set_show_state(ui::SHOW_STATE_NORMAL);
50 EXPECT_EQ(ui::SHOW_STATE_NORMAL, browser()->GetSavedWindowShowState()); 48 EXPECT_EQ(ui::SHOW_STATE_NORMAL, browser()->GetSavedWindowShowState());
51 browser()->set_show_state(ui::SHOW_STATE_MINIMIZED); 49 browser()->set_show_state(ui::SHOW_STATE_MINIMIZED);
52 EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, browser()->GetSavedWindowShowState()); 50 EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, browser()->GetSavedWindowShowState());
(...skipping 25 matching lines...) Expand all
78 76
79 // And asynchronicity kicked in properly. 77 // And asynchronicity kicked in properly.
80 MessageLoop::current()->RunAllPending(); 78 MessageLoop::current()->RunAllPending();
81 EXPECT_FALSE(off_the_record_profile_->destroyed_profile_); 79 EXPECT_FALSE(off_the_record_profile_->destroyed_profile_);
82 80
83 // I meant, ALL the render process hosts... :-) 81 // I meant, ALL the render process hosts... :-)
84 render_process_host2.release()->Cleanup(); 82 render_process_host2.release()->Cleanup();
85 MessageLoop::current()->RunAllPending(); 83 MessageLoop::current()->RunAllPending();
86 EXPECT_TRUE(off_the_record_profile_->destroyed_profile_); 84 EXPECT_TRUE(off_the_record_profile_->destroyed_profile_);
87 } 85 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698