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

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

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 .Build(); 117 .Build();
118 ExtensionRegistry* registry = ExtensionRegistry::Get(profile_.get()); 118 ExtensionRegistry* registry = ExtensionRegistry::Get(profile_.get());
119 registry->AddEnabled(adt); 119 registry->AddEnabled(adt);
120 registry->TriggerOnLoaded(adt.get()); 120 registry->TriggerOnLoaded(adt.get());
121 EXPECT_TRUE(error_console_->enabled()); 121 EXPECT_TRUE(error_console_->enabled());
122 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage()); 122 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage());
123 EXPECT_TRUE(error_console_->IsEnabledForAppsDeveloperTools()); 123 EXPECT_TRUE(error_console_->IsEnabledForAppsDeveloperTools());
124 124
125 // Unloading the Apps Developer Tools should disable error console. 125 // Unloading the Apps Developer Tools should disable error console.
126 registry->RemoveEnabled(adt->id()); 126 registry->RemoveEnabled(adt->id());
127 registry->TriggerOnUnloaded(adt.get(), UnloadedExtensionInfo::REASON_DISABLE); 127 registry->TriggerOnUnloaded(adt.get(), UnloadedExtensionReason::DISABLE);
128 EXPECT_FALSE(error_console_->enabled()); 128 EXPECT_FALSE(error_console_->enabled());
129 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage()); 129 EXPECT_FALSE(error_console_->IsEnabledForChromeExtensionsPage());
130 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools()); 130 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools());
131 } 131 }
132 132
133 // Test that errors are successfully reported. This is a simple test, since it 133 // Test that errors are successfully reported. This is a simple test, since it
134 // is tested more thoroughly in extensions/browser/error_map_unittest.cc 134 // is tested more thoroughly in extensions/browser/error_map_unittest.cc
135 TEST_F(ErrorConsoleUnitTest, ReportErrors) { 135 TEST_F(ErrorConsoleUnitTest, ReportErrors) {
136 const size_t kNumTotalErrors = 6; 136 const size_t kNumTotalErrors = 6;
137 const std::string kId = crx_file::id_util::GenerateId("id"); 137 const std::string kId = crx_file::id_util::GenerateId("id");
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 error_console_->ReportError( 273 error_console_->ReportError(
274 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); 274 CreateNewRuntimeError(packed_extension->id(), "runtime error 4"));
275 EXPECT_EQ(2u, // We should still have the first two errors. 275 EXPECT_EQ(2u, // We should still have the first two errors.
276 error_console_->GetErrorsForExtension( 276 error_console_->GetErrorsForExtension(
277 unpacked_extension->id()).size()); 277 unpacked_extension->id()).size());
278 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( 278 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension(
279 unpacked_extension->id())); 279 unpacked_extension->id()));
280 } 280 }
281 281
282 } // namespace extensions 282 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/error_console/error_console.cc ('k') | chrome/browser/extensions/extension_action_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698