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

Side by Side Diff: chrome/browser/extensions/error_console/error_console_unittest.cc

Issue 508513002: Remove implicit conversions from scoped_refptr to T* in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two more Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/error_console/error_console.h" 5 #include "chrome/browser/extensions/error_console/error_console.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ExtensionBuilder() 104 ExtensionBuilder()
105 .SetManifest( 105 .SetManifest(
106 DictionaryBuilder().Set("name", "apps dev tools") 106 DictionaryBuilder().Set("name", "apps dev tools")
107 .Set("version", "0.2.0") 107 .Set("version", "0.2.0")
108 .Set("manifest_version", 2) 108 .Set("manifest_version", 2)
109 .Build()) 109 .Build())
110 .SetID(kAppsDeveloperToolsExtensionId) 110 .SetID(kAppsDeveloperToolsExtensionId)
111 .Build(); 111 .Build();
112 ExtensionRegistry* registry = ExtensionRegistry::Get(profile_.get()); 112 ExtensionRegistry* registry = ExtensionRegistry::Get(profile_.get());
113 registry->AddEnabled(adt); 113 registry->AddEnabled(adt);
114 registry->TriggerOnLoaded(adt); 114 registry->TriggerOnLoaded(adt.get());
115 EXPECT_TRUE(error_console_->enabled()); 115 EXPECT_TRUE(error_console_->enabled());
116 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage()); 116 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage());
117 EXPECT_TRUE(error_console_->IsEnabledForAppsDeveloperTools()); 117 EXPECT_TRUE(error_console_->IsEnabledForAppsDeveloperTools());
118 118
119 // Unloading the Apps Developer Tools should disable error console. 119 // Unloading the Apps Developer Tools should disable error console.
120 registry->RemoveEnabled(adt->id()); 120 registry->RemoveEnabled(adt->id());
121 registry->TriggerOnUnloaded(adt, UnloadedExtensionInfo::REASON_DISABLE); 121 registry->TriggerOnUnloaded(adt.get(), UnloadedExtensionInfo::REASON_DISABLE);
122 EXPECT_FALSE(error_console_->enabled()); 122 EXPECT_FALSE(error_console_->enabled());
123 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage()); 123 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage());
124 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools()); 124 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools());
125 } 125 }
126 126
127 // Test that errors are successfully reported. This is a simple test, since it 127 // Test that errors are successfully reported. This is a simple test, since it
128 // is tested more thoroughly in extensions/browser/error_map_unittest.cc 128 // is tested more thoroughly in extensions/browser/error_map_unittest.cc
129 TEST_F(ErrorConsoleUnitTest, ReportErrors) { 129 TEST_F(ErrorConsoleUnitTest, ReportErrors) {
130 const size_t kNumTotalErrors = 6; 130 const size_t kNumTotalErrors = 6;
131 const std::string kId = crx_file::id_util::GenerateId("id"); 131 const std::string kId = crx_file::id_util::GenerateId("id");
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 error_console_->ReportError( 267 error_console_->ReportError(
268 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); 268 CreateNewRuntimeError(packed_extension->id(), "runtime error 4"));
269 EXPECT_EQ(2u, // We should still have the first two errors. 269 EXPECT_EQ(2u, // We should still have the first two errors.
270 error_console_->GetErrorsForExtension( 270 error_console_->GetErrorsForExtension(
271 unpacked_extension->id()).size()); 271 unpacked_extension->id()).size());
272 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( 272 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension(
273 unpacked_extension->id())); 273 unpacked_extension->id()));
274 } 274 }
275 275
276 } // namespace extensions 276 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698