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

Unified Diff: chrome/browser/ui/toolbar/toolbar_model_unittest.cc

Issue 2830893002: Refactor of ExtensionNavigationThrottle (Closed)
Patch Set: \ 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/toolbar_model_unittest.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc
index 581c5070a23679530b2d0adad0a2d4c4857abd69..4a24fa16cf540a981ace4d11a18202c9e04544a2 100644
--- a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc
@@ -21,6 +21,11 @@
#include "content/public/common/url_constants.h"
#include "ui/gfx/text_elider.h"
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/test_util.h"
+#endif
+
// Test data ------------------------------------------------------------------
namespace {
@@ -29,34 +34,34 @@ struct TestItem {
GURL url;
base::string16 expected_text;
} test_items[] = {
- {
- GURL("view-source:http://www.google.com"),
- base::ASCIIToUTF16("view-source:www.google.com")
- },
- {
- GURL("view-source:chrome://newtab/"),
- base::ASCIIToUTF16("view-source:chrome://newtab")
- },
- {
- GURL("chrome-extension://foo/bar.html"),
- base::ASCIIToUTF16("chrome-extension://foo/bar.html")
- },
- {
- GURL(url::kAboutBlankURL),
- base::ASCIIToUTF16(url::kAboutBlankURL)
- },
- {
- GURL("http://searchurl/?q=tractor+supply"),
- base::ASCIIToUTF16("searchurl/?q=tractor+supply")
- },
- {
- GURL("http://google.com/search?q=tractor+supply&espv=1"),
- base::ASCIIToUTF16("google.com/search?q=tractor+supply&espv=1")
- },
- {
- GURL("https://google.ca/search?q=tractor+supply"),
- base::ASCIIToUTF16("https://google.ca/search?q=tractor+supply")
- },
+ {
+ GURL("view-source:http://www.google.com"),
+ base::ASCIIToUTF16("view-source:www.google.com"),
+ },
+ {
+ GURL("view-source:chrome://newtab/"),
+ base::ASCIIToUTF16("view-source:chrome://newtab"),
+ },
+ {
+ GURL("chrome-extension://fooooooooooooooooooooooooooooooo/bar.html"),
+ base::ASCIIToUTF16(
+ "chrome-extension://fooooooooooooooooooooooooooooooo/bar.html"),
+ },
+ {
+ GURL(url::kAboutBlankURL), base::ASCIIToUTF16(url::kAboutBlankURL),
+ },
+ {
+ GURL("http://searchurl/?q=tractor+supply"),
+ base::ASCIIToUTF16("searchurl/?q=tractor+supply"),
+ },
+ {
+ GURL("http://google.com/search?q=tractor+supply&espv=1"),
+ base::ASCIIToUTF16("google.com/search?q=tractor+supply&espv=1"),
+ },
+ {
+ GURL("https://google.ca/search?q=tractor+supply"),
+ base::ASCIIToUTF16("https://google.ca/search?q=tractor+supply"),
+ },
};
} // namespace
@@ -91,6 +96,15 @@ void ToolbarModelTest::SetUp() {
BrowserWithTestWindowTest::SetUp();
AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
profile(), &AutocompleteClassifierFactory::BuildInstanceFor);
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ // Install a fake extension so that the ID in the chrome-extension test URL is
+ // valid. Invalid extension URLs may result in error pages (if blocked by
+ // ExtensionNavigationThrottle), which this test doesn't wish to exercise.
+ ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile())->AddEnabled(
+ extensions::test_util::CreateEmptyExtension(
+ "fooooooooooooooooooooooooooooooo")));
+#endif
}
void ToolbarModelTest::NavigateAndCheckText(
« no previous file with comments | « chrome/browser/extensions/window_open_apitest.cc ('k') | extensions/browser/extension_navigation_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698