| OLD | NEW |
| 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" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 typedef testing::Test TabModelTest; | 15 class TabModelTest : public testing::Test { |
| 16 content::TestBrowserThreadBundle thread_bundle_; |
| 17 }; |
| 15 | 18 |
| 16 namespace { | 19 namespace { |
| 17 class TabModelAndroidProfileMock : public TestingProfile { | 20 class TabModelAndroidProfileMock : public TestingProfile { |
| 18 public: | 21 public: |
| 19 TabModelAndroidProfileMock() {} | 22 TabModelAndroidProfileMock() {} |
| 20 virtual ~TabModelAndroidProfileMock() {} | 23 virtual ~TabModelAndroidProfileMock() {} |
| 21 | 24 |
| 22 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); | 25 MOCK_METHOD0(GetOffTheRecordProfile, Profile*()); |
| 23 MOCK_METHOD0(HasOffTheRecordProfile, bool()); | 26 MOCK_METHOD0(HasOffTheRecordProfile, bool()); |
| 24 }; | 27 }; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); | 78 EXPECT_EQ(&testing_profile, tab_model.GetProfile()); |
| 76 EXPECT_TRUE(tab_model.IsOffTheRecord()); | 79 EXPECT_TRUE(tab_model.IsOffTheRecord()); |
| 77 | 80 |
| 78 // Notify profile is being destroyed and verify pointer is cleared. | 81 // Notify profile is being destroyed and verify pointer is cleared. |
| 79 content::NotificationService::current()->Notify( | 82 content::NotificationService::current()->Notify( |
| 80 chrome::NOTIFICATION_PROFILE_DESTROYED, | 83 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 81 content::Source<Profile>(&testing_profile), | 84 content::Source<Profile>(&testing_profile), |
| 82 content::NotificationService::NoDetails()); | 85 content::NotificationService::NoDetails()); |
| 83 EXPECT_EQ(NULL, tab_model.GetProfile()); | 86 EXPECT_EQ(NULL, tab_model.GetProfile()); |
| 84 } | 87 } |
| OLD | NEW |