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

Side by Side Diff: chrome/browser/plugin_exceptions_table_model_unittest.cc

Issue 5998002: Revert "Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/plugin_exceptions_table_model.cc ('k') | chrome/browser/plugin_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "app/table_model_observer.h" 5 #include "app/table_model_observer.h"
6 #include "base/auto_reset.h" 6 #include "base/auto_reset.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/mock_plugin_exceptions_table_model.h" 9 #include "chrome/browser/mock_plugin_exceptions_table_model.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/test/testing_pref_service.h" 12 #include "chrome/test/testing_pref_service.h"
13 #include "chrome/test/testing_profile.h" 13 #include "chrome/test/testing_profile.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/plugins/npapi/plugin_group.h" 16 #include "webkit/glue/plugins/plugin_group.h"
17 #include "webkit/plugins/npapi/webplugininfo.h" 17 #include "webkit/glue/plugins/webplugininfo.h"
18 18
19 // Can't be an internal namespace because PluginExceptionsTableModel declares 19 // Can't be an internal namespace because PluginExceptionsTableModel declares
20 // as a friend. 20 // as a friend.
21 namespace plugin_test_internal { 21 namespace plugin_test_internal {
22 22
23 using ::testing::_; 23 using ::testing::_;
24 using ::testing::Invoke; 24 using ::testing::Invoke;
25 25
26 class MockTableModelObserver : public TableModelObserver { 26 class MockTableModelObserver : public TableModelObserver {
27 public: 27 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 CONTENT_SETTINGS_TYPE_PLUGINS, 78 CONTENT_SETTINGS_TYPE_PLUGINS,
79 "b-bar", 79 "b-bar",
80 CONTENT_SETTING_BLOCK); 80 CONTENT_SETTING_BLOCK);
81 map->SetContentSetting(example_com, 81 map->SetContentSetting(example_com,
82 CONTENT_SETTINGS_TYPE_PLUGINS, 82 CONTENT_SETTINGS_TYPE_PLUGINS,
83 "b-bar", 83 "b-bar",
84 CONTENT_SETTING_ALLOW); 84 CONTENT_SETTING_ALLOW);
85 85
86 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL)); 86 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL));
87 87
88 std::vector<webkit::npapi::PluginGroup> plugins; 88 std::vector<PluginGroup> plugins;
89 webkit::npapi::WebPluginInfo foo_plugin; 89 WebPluginInfo foo_plugin;
90 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); 90 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo"));
91 foo_plugin.name = ASCIIToUTF16("FooPlugin"); 91 foo_plugin.name = ASCIIToUTF16("FooPlugin");
92 foo_plugin.enabled = true; 92 foo_plugin.enabled = true;
93 scoped_ptr<webkit::npapi::PluginGroup> foo_group( 93 scoped_ptr<PluginGroup> foo_group(
94 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); 94 PluginGroup::FromWebPluginInfo(foo_plugin));
95 plugins.push_back(*foo_group); 95 plugins.push_back(*foo_group);
96 96
97 webkit::npapi::WebPluginInfo bar_plugin; 97 WebPluginInfo bar_plugin;
98 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); 98 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar"));
99 bar_plugin.name = ASCIIToUTF16("BarPlugin"); 99 bar_plugin.name = ASCIIToUTF16("BarPlugin");
100 bar_plugin.enabled = true; 100 bar_plugin.enabled = true;
101 scoped_ptr<webkit::npapi::PluginGroup> bar_group( 101 scoped_ptr<PluginGroup> bar_group(
102 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); 102 PluginGroup::FromWebPluginInfo(bar_plugin));
103 plugins.push_back(*bar_group); 103 plugins.push_back(*bar_group);
104 104
105 table_model_->set_plugins(plugins); 105 table_model_->set_plugins(plugins);
106 table_model_->ReloadSettings(); 106 table_model_->ReloadSettings();
107 } 107 }
108 108
109 protected: 109 protected:
110 void CheckInvariants() { 110 void CheckInvariants() {
111 typedef std::deque<PluginExceptionsTableModel::SettingsEntry> Entries; 111 typedef std::deque<PluginExceptionsTableModel::SettingsEntry> Entries;
112 Entries& settings = table_model_->settings_; 112 Entries& settings = table_model_->settings_;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); 208 plugin_test_internal::MockTableModelObserver observer(table_model_.get());
209 table_model_->SetObserver(&observer); 209 table_model_->SetObserver(&observer);
210 210
211 EXPECT_CALL(observer, OnModelChanged()); 211 EXPECT_CALL(observer, OnModelChanged());
212 table_model_->RemoveAll(); 212 table_model_->RemoveAll();
213 EXPECT_EQ(0, table_model_->RowCount()); 213 EXPECT_EQ(0, table_model_->RowCount());
214 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); 214 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size()));
215 CheckInvariants(); 215 CheckInvariants();
216 table_model_->SetObserver(NULL); 216 table_model_->SetObserver(NULL);
217 } 217 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_exceptions_table_model.cc ('k') | chrome/browser/plugin_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698