OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/notifications/notification_exceptions_table_model.h" | 5 #include "chrome/browser/notifications/notification_exceptions_table_model.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
9 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
10 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
11 #include "content/browser/renderer_host/test_render_view_host.h" | |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 | 15 |
16 class NotificationExceptionsTableModelTest : public RenderViewHostTestHarness { | 16 class NotificationExceptionsTableModelTest |
| 17 : public ChromeRenderViewHostTestHarness { |
17 public: | 18 public: |
18 NotificationExceptionsTableModelTest() | 19 NotificationExceptionsTableModelTest() |
19 : ui_thread_(BrowserThread::UI, MessageLoop::current()) { | 20 : ui_thread_(BrowserThread::UI, MessageLoop::current()) { |
20 } | 21 } |
21 | 22 |
22 virtual ~NotificationExceptionsTableModelTest() { | 23 virtual ~NotificationExceptionsTableModelTest() { |
23 } | 24 } |
24 | 25 |
25 virtual void SetUp() { | 26 virtual void SetUp() { |
26 RenderViewHostTestHarness::SetUp(); | 27 ChromeRenderViewHostTestHarness::SetUp(); |
27 service_ = DesktopNotificationServiceFactory::GetForProfile(profile()); | 28 service_ = DesktopNotificationServiceFactory::GetForProfile(profile()); |
28 ResetModel(); | 29 ResetModel(); |
29 } | 30 } |
30 | 31 |
31 virtual void TearDown() { | 32 virtual void TearDown() { |
32 model_.reset(NULL); | 33 model_.reset(NULL); |
33 RenderViewHostTestHarness::TearDown(); | 34 ChromeRenderViewHostTestHarness::TearDown(); |
34 } | 35 } |
35 | 36 |
36 virtual void ResetModel() { | 37 virtual void ResetModel() { |
37 model_.reset(new NotificationExceptionsTableModel(service_)); | 38 model_.reset(new NotificationExceptionsTableModel(service_)); |
38 } | 39 } |
39 | 40 |
40 virtual void FillData() { | 41 virtual void FillData() { |
41 service_->GrantPermission(GURL("http://e-allowed2.com")); | 42 service_->GrantPermission(GURL("http://e-allowed2.com")); |
42 service_->GrantPermission(GURL("http://allowed.com")); | 43 service_->GrantPermission(GURL("http://allowed.com")); |
43 | 44 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 RemoveRowsTableModel::Rows rows; | 123 RemoveRowsTableModel::Rows rows; |
123 rows.insert(0); | 124 rows.insert(0); |
124 rows.insert(1); | 125 rows.insert(1); |
125 rows.insert(2); | 126 rows.insert(2); |
126 model_->RemoveRows(rows); | 127 model_->RemoveRows(rows); |
127 } | 128 } |
128 EXPECT_EQ(0, model_->RowCount()); | 129 EXPECT_EQ(0, model_->RowCount()); |
129 service_->GetNotificationsSettings(&settings); | 130 service_->GetNotificationsSettings(&settings); |
130 EXPECT_EQ(0u, settings.size()); | 131 EXPECT_EQ(0u, settings.size()); |
131 } | 132 } |
OLD | NEW |