1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/ui/toolbar/origin_chip_info.h"
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/command_line.h"
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/files/file_path.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/strings/stringprintf.h"
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/strings/utf_string_conversions.h"
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/extensions/extension_service.h"
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/extensions/test_extension_system.h"
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/ui/toolbar/test_toolbar_model.h"
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/test/base/chrome_render_view_host_test_harness.h"
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/test/base/testing_profile.h"
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/test/test_browser_thread_bundle.h"
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "extensions/common/extension_builder.h"
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "grit/chromium_strings.h"
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "grit/generated_resources.h"
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "grit/theme_resources.h"
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/base/l10n/l10n_util.h"
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/chromeos/login/users/user_manager.h"
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/settings/cros_settings.h"
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/chromeos/settings/device_settings_service.h"
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace {
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const char kExampleUrl[] = "http://www.example.com/";
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const char kExampleUrlSecure[] = "https://www.example.com/";
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)const char kOtherUrl[] = "http://chrome.google.com/";
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class OriginChipInfoTest : public ChromeRenderViewHostTestHarness,
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                           public extensions::IconImage::Observer {
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public:
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  OriginChipInfoTest() : icon_image_(NULL) {}
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  TestToolbarModel* toolbar_model() { return toolbar_model_.get(); }
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  OriginChipInfo* info() { return info_.get(); }
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const GURL& url() const { return url_; }
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const extensions::IconImage* icon_image() const { return icon_image_; }
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void SetURL(const std::string& dest_url, bool expect_update) {
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    url_ = GURL(dest_url);
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    NavigateAndCommit(url_);
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    toolbar_model_->set_url(url_);
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    EXPECT_EQ(expect_update, info_->Update(web_contents(), toolbar_model()));
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void SetUp() OVERRIDE {
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    ChromeRenderViewHostTestHarness::SetUp();
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    test_user_manager_.reset(new chromeos::ScopedTestUserManager());
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    toolbar_model_.reset(new TestToolbarModel());
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    info_.reset(new OriginChipInfo(this, profile()));
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void TearDown() OVERRIDE {
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    info_.reset();
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    toolbar_model_.reset();
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    test_user_manager_.reset();
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    ChromeRenderViewHostTestHarness::TearDown();
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void OnExtensionIconImageChanged(
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      extensions::IconImage* image) OVERRIDE {
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // We keep the value of |image| to check if it's set, but the actual value
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // is never used.
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    icon_image_ = image;
78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  }
79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private:
81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<OriginChipInfo> info_;
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<TestToolbarModel> toolbar_model_;
83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  GURL url_;
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  extensions::IconImage* icon_image_;
85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#if defined(OS_CHROMEOS)
87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // OriginChipInfo sometimes calls into the extensions system, which, on CrOS,
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // requires these services to be initialized.
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  chromeos::ScopedTestCrosSettings test_cros_settings_;
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(OriginChipInfoTest);
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, NoChangeShouldNotUpdate) {
98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, true);
99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, false);
100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, ChangeShouldUpdate) {
103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, true);
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kOtherUrl, true);
105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, NormalOrigin) {
108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, true);
109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16("example.com"), info()->label());
111010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(kExampleUrl), info()->Tooltip());
112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(url(), info()->displayed_url());
113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(ToolbarModel::NONE, info()->security_level());
114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, EVSecureOrigin) {
117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  toolbar_model()->set_security_level(ToolbarModel::EV_SECURE);
118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  toolbar_model()->set_ev_cert_name(base::ASCIIToUTF16("Example [US]"));
119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrlSecure, true);
120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
121a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16("Example [US] example.com"), info()->label());
122010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(kExampleUrlSecure), info()->Tooltip());
123a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(url(), info()->displayed_url());
124a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(ToolbarModel::EV_SECURE, info()->security_level());
125a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
127a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, ChromeOrigin) {
128010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  const char kChromeOrigin1[] = "chrome://version/";
129010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  SetURL(kChromeOrigin1, true);
130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE),
132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)            info()->label());
133010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(kChromeOrigin1), info()->Tooltip());
134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(url(), info()->displayed_url());
135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(IDR_PRODUCT_LOGO_16, info()->icon());
136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
137a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // chrome://flags has no title, so the title should be the product name.
138010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  const char kChromeOrigin2[] = "chrome://flags/";
139010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  SetURL(kChromeOrigin2, true);
140a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
141a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME), info()->label());
142010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(kChromeOrigin2), info()->Tooltip());
143a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(url(), info()->displayed_url());
144a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(IDR_PRODUCT_LOGO_16, info()->icon());
145a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
146a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, true);
147a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_NE(IDR_PRODUCT_LOGO_16, info()->icon());
148a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
149a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST_F(OriginChipInfoTest, ExtensionOrigin) {
151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  CommandLine command_line(CommandLine::NO_PROGRAM);
152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  extensions::TestExtensionSystem* test_extension_system =
153a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      static_cast<extensions::TestExtensionSystem*>(
154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)          extensions::ExtensionSystem::Get(profile()));
155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
156a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // |extension_service| is owned by |profile()|.
157a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  ExtensionService* extension_service =
158a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      test_extension_system->CreateExtensionService(&command_line,
159a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                                    base::FilePath(),
160a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                                    false);
161a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
162a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Create a dummy extension.
163a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const char kFooId[] = "hhgbjpmdppecanaaogonaigmmifgpaph";
164a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const char kFooName[] = "Foo";
165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  extensions::ExtensionBuilder foo_extension;
166a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  foo_extension.SetManifest(extensions::DictionaryBuilder()
167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                .Set("name", kFooName)
168a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                .Set("version", "1.0.0")
169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                .Set("manifest_version", 2));
170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  foo_extension.SetID(kFooId);
171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  extension_service->AddExtension(foo_extension.Build().get());
172a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const extensions::IconImage* null_image = NULL;
174a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Navigate to a URL from that extension.
176010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  const std::string extension_origin =
177010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      base::StringPrintf("chrome-extension://%s/index.html", kFooId);
178010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  SetURL(extension_origin, true);
179a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_NE(null_image, icon_image());
180a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label());
181010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip());
182a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
183a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  SetURL(kExampleUrl, true);
184a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(null_image, icon_image());
185a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
186