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

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

Issue 301033004: replaced the string 'chrome-extensions://' with constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed yet another style issue Created 6 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_commands.h" 12 #include "chrome/browser/ui/browser_commands.h"
13 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/url_constants.h"
17 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
18 #include "extensions/browser/extension_host.h" 19 #include "extensions/browser/extension_host.h"
19 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
20 #include "extensions/browser/process_manager.h" 21 #include "extensions/browser/process_manager.h"
22 #include "extensions/common/constants.h"
21 23
22 using content::RenderViewHost; 24 using content::RenderViewHost;
23 using content::WebContents; 25 using content::WebContents;
24 using extensions::Extension; 26 using extensions::Extension;
25 27
26 class GtalkExtensionTest : public ExtensionBrowserTest { 28 class GtalkExtensionTest : public ExtensionBrowserTest {
27 protected: 29 protected:
28 extensions::ProcessManager* GetProcessManager() { 30 extensions::ProcessManager* GetProcessManager() {
29 return extensions::ExtensionSystem::Get(browser()->profile())-> 31 return extensions::ExtensionSystem::Get(browser()->profile())->
30 process_manager(); 32 process_manager();
(...skipping 12 matching lines...) Expand all
43 45
44 RenderViewHost* GetViewer() { 46 RenderViewHost* GetViewer() {
45 std::vector<RenderViewHost*> views = GetMatchingViews(GetViewerUrl()); 47 std::vector<RenderViewHost*> views = GetMatchingViews(GetViewerUrl());
46 EXPECT_EQ(1U, views.size()); 48 EXPECT_EQ(1U, views.size());
47 if (views.empty()) 49 if (views.empty())
48 return NULL; 50 return NULL;
49 return views.front(); 51 return views.front();
50 } 52 }
51 53
52 std::string GetViewerUrl() { 54 std::string GetViewerUrl() {
53 return "chrome-extension://" + GetInstalledExtensionId() + "/viewer.html"; 55 return std::string(extensions::kExtensionScheme) +
56 content::kStandardSchemeSeparator +
Yoyo Zhou 2014/05/30 15:12:02 Line continuations should be 4 spaces. Please run
57 GetInstalledExtensionId() + "/viewer.html";
54 } 58 }
55 59
56 std::vector<RenderViewHost*> GetMatchingViews(const std::string& url_query) { 60 std::vector<RenderViewHost*> GetMatchingViews(const std::string& url_query) {
57 extensions::ProcessManager* manager = GetProcessManager(); 61 extensions::ProcessManager* manager = GetProcessManager();
58 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); 62 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews();
59 std::vector<RenderViewHost*> matching_views; 63 std::vector<RenderViewHost*> matching_views;
60 for (extensions::ProcessManager::ViewSet::const_iterator iter = 64 for (extensions::ProcessManager::ViewSet::const_iterator iter =
61 all_views.begin(); iter != all_views.end(); ++iter) { 65 all_views.begin(); iter != all_views.end(); ++iter) {
62 WebContents* web_contents = WebContents::FromRenderViewHost(*iter); 66 WebContents* web_contents = WebContents::FromRenderViewHost(*iter);
63 std::string url = web_contents->GetURL().spec(); 67 std::string url = web_contents->GetURL().spec();
(...skipping 16 matching lines...) Expand all
80 }; 84 };
81 85
82 IN_PROC_BROWSER_TEST_F(GtalkExtensionTest, InstallCurrent) { 86 IN_PROC_BROWSER_TEST_F(GtalkExtensionTest, InstallCurrent) {
83 content::WindowedNotificationObserver panel_loaded( 87 content::WindowedNotificationObserver panel_loaded(
84 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, 88 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED,
85 content::NotificationService::AllSources()); 89 content::NotificationService::AllSources());
86 InstallGtalkExtension(ReadCurrentVersion()); 90 InstallGtalkExtension(ReadCurrentVersion());
87 panel_loaded.Wait(); 91 panel_loaded.Wait();
88 ASSERT_TRUE(GetViewer()); 92 ASSERT_TRUE(GetViewer());
89 } 93 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_crash_recovery_browsertest.cc ('k') | chrome/browser/extensions/window_open_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698