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

Side by Side Diff: chrome/test/automation/extension_proxy_uitest.cc

Issue 8584013: gtest / gmock shouldn't be in the shipping product (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert t_a_p change Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/extension_proxy.cc ('k') | chrome/test/perf/startup_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/common/chrome_paths.h" 7 #include "chrome/common/chrome_paths.h"
8 #include "chrome/test/automation/automation_proxy.h" 8 #include "chrome/test/automation/automation_proxy.h"
9 #include "chrome/test/automation/browser_proxy.h" 9 #include "chrome/test/automation/browser_proxy.h"
10 #include "chrome/test/automation/extension_proxy.h" 10 #include "chrome/test/automation/extension_proxy.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // TODO(phajdan.jr): Use net/test/test_server instead of layout test server. 113 // TODO(phajdan.jr): Use net/test/test_server instead of layout test server.
114 LayoutTestHttpServer http_server(path, 1365); 114 LayoutTestHttpServer http_server(path, 1365);
115 ASSERT_TRUE(http_server.Start()); 115 ASSERT_TRUE(http_server.Start());
116 GURL localhost = GURL("http://localhost:1365"); 116 GURL localhost = GURL("http://localhost:1365");
117 NavigateToURL(localhost); 117 NavigateToURL(localhost);
118 118
119 // Click the browser action, which should rename the tab title to 119 // Click the browser action, which should rename the tab title to
120 // the tab's index. 120 // the tab's index.
121 ASSERT_TRUE(rename_tab_extension-> 121 ASSERT_TRUE(rename_tab_extension->
122 ExecuteActionInActiveTabAsync(browser.get())); 122 ExecuteActionInActiveTabAsync(browser.get()));
123 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); 123
124 bool result;
125 std::string message;
126
127 if (!automation()->GetExtensionTestResult(&result, &message))
128 FAIL() << "Could not send WaitForExtensionTestResult message";
129 ASSERT_TRUE(result) << "Extension test message: " << message;
124 130
125 scoped_refptr<TabProxy> display_tab = browser->GetTab(0); 131 scoped_refptr<TabProxy> display_tab = browser->GetTab(0);
126 ASSERT_TRUE(display_tab); 132 ASSERT_TRUE(display_tab);
127 std::wstring title_wstring; 133 std::wstring title_wstring;
128 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring)); 134 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring));
129 ASSERT_STREQ(L"0", title_wstring.c_str()); 135 ASSERT_STREQ(L"0", title_wstring.c_str());
130 136
131 // Click the action again right after navigating to a new page. 137 // Click the action again right after navigating to a new page.
132 ASSERT_TRUE(browser->AppendTab(localhost)); 138 ASSERT_TRUE(browser->AppendTab(localhost));
133 display_tab = browser->GetTab(1); 139 display_tab = browser->GetTab(1);
134 ASSERT_TRUE(display_tab); 140 ASSERT_TRUE(display_tab);
135 ASSERT_TRUE(rename_tab_extension-> 141 ASSERT_TRUE(rename_tab_extension->
136 ExecuteActionInActiveTabAsync(browser.get())); 142 ExecuteActionInActiveTabAsync(browser.get()));
137 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); 143 if (!automation()->GetExtensionTestResult(&result, &message))
144 FAIL() << "Could not send WaitForExtensionTestResult message";
145 ASSERT_TRUE(result) << "Extension test message: " << message;
138 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring)); 146 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring));
139 ASSERT_STREQ(L"1", title_wstring.c_str()); 147 ASSERT_STREQ(L"1", title_wstring.c_str());
140 148
141 // Do not forget to stop the server. 149 // Do not forget to stop the server.
142 ASSERT_TRUE(http_server.Stop()); 150 ASSERT_TRUE(http_server.Stop());
143 } 151 }
144 152
145 // Flaky, http://crbug.com/59441. 153 // Flaky, http://crbug.com/59441.
146 TEST_F(ExtensionProxyUITest, FLAKY_MoveBrowserAction) { 154 TEST_F(ExtensionProxyUITest, FLAKY_MoveBrowserAction) {
155 int action_index;
156
147 scoped_refptr<ExtensionProxy> rename_tab_extension = 157 scoped_refptr<ExtensionProxy> rename_tab_extension =
148 InstallRenameTabExtension(); 158 InstallRenameTabExtension();
149 ASSERT_TRUE(rename_tab_extension.get()); 159 ASSERT_TRUE(rename_tab_extension.get());
150 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 160
151 EnsureBrowserActionIndexMatches(0)); 161 ASSERT_TRUE(simple_extension_->GetBrowserActionIndex(&action_index));
152 ASSERT_NO_FATAL_FAILURE(rename_tab_extension-> 162 ASSERT_EQ(0, action_index);
153 EnsureBrowserActionIndexMatches(1)); 163 ASSERT_TRUE(rename_tab_extension->GetBrowserActionIndex(&action_index));
164 ASSERT_EQ(1, action_index);
154 165
155 // Move google translate to the end, then beginning, and verify. 166 // Move google translate to the end, then beginning, and verify.
156 ASSERT_TRUE(simple_extension_->MoveBrowserAction(1)); 167 ASSERT_TRUE(simple_extension_->MoveBrowserAction(1));
157 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 168 ASSERT_TRUE(simple_extension_->GetBrowserActionIndex(&action_index));
158 EnsureBrowserActionIndexMatches(1)); 169 ASSERT_EQ(1, action_index);
159 ASSERT_NO_FATAL_FAILURE(rename_tab_extension-> 170 ASSERT_TRUE(rename_tab_extension->GetBrowserActionIndex(&action_index));
160 EnsureBrowserActionIndexMatches(0)); 171 ASSERT_EQ(0, action_index);
172
161 ASSERT_TRUE(simple_extension_->MoveBrowserAction(0)); 173 ASSERT_TRUE(simple_extension_->MoveBrowserAction(0));
162 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 174 ASSERT_TRUE(simple_extension_->GetBrowserActionIndex(&action_index));
163 EnsureBrowserActionIndexMatches(0)); 175 ASSERT_EQ(0, action_index);
164 ASSERT_NO_FATAL_FAILURE(rename_tab_extension-> 176 ASSERT_TRUE(rename_tab_extension->GetBrowserActionIndex(&action_index));
165 EnsureBrowserActionIndexMatches(1)); 177 ASSERT_EQ(1, action_index);
166 178
167 // Try moving browser action to invalid index. 179 // Try moving browser action to invalid index.
168 ASSERT_FALSE(simple_extension_->MoveBrowserAction(-1)); 180 ASSERT_FALSE(simple_extension_->MoveBrowserAction(-1));
169 ASSERT_FALSE(simple_extension_->MoveBrowserAction(2)); 181 ASSERT_FALSE(simple_extension_->MoveBrowserAction(2));
170 } 182 }
171 183
172 // Flaky, http://crbug.com/59440. 184 // Flaky, http://crbug.com/59440.
173 TEST_F(ExtensionProxyUITest, FLAKY_GetProperty) { 185 TEST_F(ExtensionProxyUITest, FLAKY_GetProperty) {
174 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 186 std::string id;
175 EnsureIdMatches("aiglobglfckejlcpcbdokbkbjeemfhno")); 187 ASSERT_TRUE(simple_extension_->GetId(&id));
176 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 188 ASSERT_EQ("aiglobglfckejlcpcbdokbkbjeemfhno", id);
177 EnsureNameMatches("Browser Action")); 189
178 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 190 std::string name;
179 EnsureVersionMatches("0.1.1")); 191 ASSERT_TRUE(simple_extension_->GetName(&name));
180 ASSERT_NO_FATAL_FAILURE(simple_extension_-> 192 ASSERT_EQ("Browser Action", name);
181 EnsureBrowserActionIndexMatches(0)); 193
194 std::string version;
195 ASSERT_TRUE(simple_extension_->GetVersion(&version));
196 ASSERT_EQ("0.1.1", version);
197
198 int browser_action_index;
199 ASSERT_TRUE(simple_extension_->GetBrowserActionIndex(&browser_action_index));
200 ASSERT_EQ(0, browser_action_index);
182 } 201 }
183 202
184 } // namespace 203 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/automation/extension_proxy.cc ('k') | chrome/test/perf/startup_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698