| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/options/content_exceptions_window_gtk.h" | 5 #include "chrome/browser/gtk/options/content_exceptions_window_gtk.h" |
| 6 | 6 |
| 7 #include "chrome/test/testing_profile.h" | 7 #include "chrome/test/testing_profile.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 using ::testing::ElementsAre; | 11 using ::testing::ElementsAre; |
| 12 | 12 |
| 13 class ContentExceptionsWindowGtkUnittest : public testing::Test { | 13 class ContentExceptionsWindowGtkUnittest : public testing::Test { |
| 14 public: | 14 public: |
| 15 ContentExceptionsWindowGtkUnittest() | 15 ContentExceptionsWindowGtkUnittest() |
| 16 : ui_thread_(BrowserThread::UI, &message_loop_), | 16 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 17 host_content_settings_map_(profile_.GetHostContentSettingsMap()), | 17 host_content_settings_map_(profile_.GetHostContentSettingsMap()), |
| 18 window_(NULL) { | 18 window_(NULL) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 ~ContentExceptionsWindowGtkUnittest() { | 21 ~ContentExceptionsWindowGtkUnittest() { |
| 22 // This will delete window_ too. | 22 // This will delete window_ too. |
| 23 gtk_widget_destroy(window_->dialog_); | 23 gtk_widget_destroy(window_->dialog_); |
| 24 message_loop_.RunAllPending(); | 24 message_loop_.RunAllPending(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void AddException(const std::string& pattern, ContentSetting value) { | 27 void AddException(const std::string& pattern, ContentSetting value) { |
| 28 host_content_settings_map_->SetContentSetting( | 28 host_content_settings_map_->SetContentSetting( |
| 29 HostContentSettingsMap::Pattern(pattern), | 29 ContentSettingsPattern(pattern), |
| 30 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 30 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 31 "", | 31 "", |
| 32 value); | 32 value); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void BuildWindow() { | 35 void BuildWindow() { |
| 36 window_ = new ContentExceptionsWindowGtk( | 36 window_ = new ContentExceptionsWindowGtk( |
| 37 NULL, | 37 NULL, |
| 38 host_content_settings_map_, | 38 host_content_settings_map_, |
| 39 NULL, | 39 NULL, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 Remove(); | 202 Remove(); |
| 203 | 203 |
| 204 std::set<std::pair<int, int> > selected; | 204 std::set<std::pair<int, int> > selected; |
| 205 GetSelectedRows(&selected); | 205 GetSelectedRows(&selected); |
| 206 | 206 |
| 207 ASSERT_EQ(1u, selected.size()); | 207 ASSERT_EQ(1u, selected.size()); |
| 208 EXPECT_EQ(1, selected.begin()->first); | 208 EXPECT_EQ(1, selected.begin()->first); |
| 209 EXPECT_EQ(1, selected.begin()->second); | 209 EXPECT_EQ(1, selected.begin()->second); |
| 210 EXPECT_THAT(Paths(), ElementsAre("a", "c", "e")); | 210 EXPECT_THAT(Paths(), ElementsAre("a", "c", "e")); |
| 211 } | 211 } |
| OLD | NEW |