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

Side by Side Diff: chrome/browser/extensions/extension_menu_manager_unittest.cc

Issue 2808027: Fix a unit test leak.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('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 <vector> 5 #include <vector>
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/scoped_vector.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/browser/extensions/extension_menu_manager.h" 12 #include "chrome/browser/extensions/extension_menu_manager.h"
12 #include "chrome/browser/extensions/extension_message_service.h" 13 #include "chrome/browser/extensions/extension_message_service.h"
13 #include "chrome/browser/extensions/test_extension_prefs.h" 14 #include "chrome/browser/extensions/test_extension_prefs.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
17 #include "chrome/common/notification_service.h" 18 #include "chrome/common/notification_service.h"
18 #include "chrome/test/testing_profile.h" 19 #include "chrome/test/testing_profile.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 16 matching lines...) Expand all
36 ExtensionMenuItem::Type type = ExtensionMenuItem::NORMAL; 37 ExtensionMenuItem::Type type = ExtensionMenuItem::NORMAL;
37 ExtensionMenuItem::ContextList contexts(ExtensionMenuItem::ALL); 38 ExtensionMenuItem::ContextList contexts(ExtensionMenuItem::ALL);
38 ExtensionMenuItem::ContextList enabled_contexts = contexts; 39 ExtensionMenuItem::ContextList enabled_contexts = contexts;
39 return new ExtensionMenuItem(extension->id(), "test", false, type, contexts, 40 return new ExtensionMenuItem(extension->id(), "test", false, type, contexts,
40 enabled_contexts); 41 enabled_contexts);
41 } 42 }
42 43
43 // Creates and returns a test Extension. The caller does *not* own the return 44 // Creates and returns a test Extension. The caller does *not* own the return
44 // value. 45 // value.
45 Extension* AddExtension(std::string name) { 46 Extension* AddExtension(std::string name) {
46 return prefs_.AddExtension(name); 47 Extension* extension = prefs_.AddExtension(name);
48 extensions_.push_back(extension);
49 return extension;
47 } 50 }
48 51
49 protected: 52 protected:
50 ExtensionMenuManager manager_; 53 ExtensionMenuManager manager_;
54 ScopedVector<Extension> extensions_;
51 TestExtensionPrefs prefs_; 55 TestExtensionPrefs prefs_;
52 56
53 private: 57 private:
54 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManagerTest); 58 DISALLOW_COPY_AND_ASSIGN(ExtensionMenuManagerTest);
55 }; 59 };
56 60
57 // Tests adding, getting, and removing items. 61 // Tests adding, getting, and removing items.
58 TEST_F(ExtensionMenuManagerTest, AddGetRemoveItems) { 62 TEST_F(ExtensionMenuManagerTest, AddGetRemoveItems) {
59 Extension* extension = AddExtension("test"); 63 Extension* extension = AddExtension("test");
60 64
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 ASSERT_EQ(params.page_url.spec(), tmp); 399 ASSERT_EQ(params.page_url.spec(), tmp);
396 400
397 std::wstring wide_tmp; 401 std::wstring wide_tmp;
398 ASSERT_TRUE(info->GetString(L"selectionText", &wide_tmp)); 402 ASSERT_TRUE(info->GetString(L"selectionText", &wide_tmp));
399 ASSERT_EQ(params.selection_text, wide_tmp); 403 ASSERT_EQ(params.selection_text, wide_tmp);
400 404
401 bool bool_tmp = true; 405 bool bool_tmp = true;
402 ASSERT_TRUE(info->GetBoolean(L"editable", &bool_tmp)); 406 ASSERT_TRUE(info->GetBoolean(L"editable", &bool_tmp));
403 ASSERT_EQ(params.is_editable, bool_tmp); 407 ASSERT_EQ(params.is_editable, bool_tmp);
404 } 408 }
OLDNEW
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698