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

Side by Side Diff: chrome/browser/ui/android/tab_model/tab_model_unittest.cc

Issue 900733003: Update {virtual,override,final} to follow C++11 style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 #include "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/ui/android/tab_model/tab_model.h" 7 #include "chrome/browser/ui/android/tab_model/tab_model.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/browser/notification_service.h" 9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
(...skipping 11 matching lines...) Expand all
22 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); 22 MOCK_METHOD0(GetOffTheRecordProfile, Profile*());
23 MOCK_METHOD0(HasOffTheRecordProfile, bool()); 23 MOCK_METHOD0(HasOffTheRecordProfile, bool());
24 }; 24 };
25 } // namespace 25 } // namespace
26 26
27 class TestTabModel : public TabModel { 27 class TestTabModel : public TabModel {
28 public: 28 public:
29 explicit TestTabModel(Profile* profile) 29 explicit TestTabModel(Profile* profile)
30 : TabModel(profile) {} 30 : TabModel(profile) {}
31 31
32 virtual int GetTabCount() const override { return 0; } 32 int GetTabCount() const override { return 0; }
33 virtual int GetActiveIndex() const override { return 0; } 33 int GetActiveIndex() const override { return 0; }
34 virtual content::WebContents* GetWebContentsAt(int index) const override { 34 content::WebContents* GetWebContentsAt(int index) const override {
35 return NULL; 35 return NULL;
36 } 36 }
37 virtual void CreateTab(content::WebContents* web_contents, 37 void CreateTab(content::WebContents* web_contents,
38 int parent_tab_id) override {} 38 int parent_tab_id) override {}
39 virtual content::WebContents* CreateNewTabForDevTools( 39 content::WebContents* CreateNewTabForDevTools(const GURL& url) override {
40 const GURL& url) override {
41 return NULL; 40 return NULL;
42 } 41 }
43 virtual bool IsSessionRestoreInProgress() const override { return false; } 42 bool IsSessionRestoreInProgress() const override { return false; }
44 virtual TabAndroid* GetTabAt(int index) const override { 43 TabAndroid* GetTabAt(int index) const override { return NULL; }
45 return NULL; 44 void SetActiveIndex(int index) override {}
46 } 45 void CloseTabAt(int index) override {}
47 virtual void SetActiveIndex(int index) override {}
48 virtual void CloseTabAt(int index) override {}
49 }; 46 };
50 47
51 TEST_F(TabModelTest, TestProfileHandling) { 48 TEST_F(TabModelTest, TestProfileHandling) {
52 // Construct TabModel with standard Profile. 49 // Construct TabModel with standard Profile.
53 TestingProfile testing_profile; 50 TestingProfile testing_profile;
54 TestTabModel tab_model(&testing_profile); 51 TestTabModel tab_model(&testing_profile);
55 52
56 // Verify TabModel has the correct profile and profile type. 53 // Verify TabModel has the correct profile and profile type.
57 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); 54 EXPECT_EQ(&testing_profile, tab_model.GetProfile());
58 EXPECT_FALSE(tab_model.IsOffTheRecord()); 55 EXPECT_FALSE(tab_model.IsOffTheRecord());
(...skipping 19 matching lines...) Expand all
78 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); 75 EXPECT_EQ(&testing_profile, tab_model.GetProfile());
79 EXPECT_TRUE(tab_model.IsOffTheRecord()); 76 EXPECT_TRUE(tab_model.IsOffTheRecord());
80 77
81 // Notify profile is being destroyed and verify pointer is cleared. 78 // Notify profile is being destroyed and verify pointer is cleared.
82 content::NotificationService::current()->Notify( 79 content::NotificationService::current()->Notify(
83 chrome::NOTIFICATION_PROFILE_DESTROYED, 80 chrome::NOTIFICATION_PROFILE_DESTROYED,
84 content::Source<Profile>(&testing_profile), 81 content::Source<Profile>(&testing_profile),
85 content::NotificationService::NoDetails()); 82 content::NotificationService::NoDetails());
86 EXPECT_EQ(NULL, tab_model.GetProfile()); 83 EXPECT_EQ(NULL, tab_model.GetProfile());
87 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698