summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-15 22:10:01 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-15 22:10:01 +0000
commit8d167c212898cb233c51abf13913541c86cfd9ae (patch)
treef33768df22c405d0ea3e3521a14fc03f565fc07d /chrome
parentdce08b668bed17b26e497ca56129538ba3da0b42 (diff)
downloadchromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.zip
chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.gz
chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.bz2
Even more test cleanup. Some fixes to non-test code that's regressed.
BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6523032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autofill/billing_address.h54
-rw-r--r--chrome/browser/autofill/billing_address_unittest.cc787
-rw-r--r--chrome/browser/content_settings/content_settings_base_provider.cc16
-rw-r--r--chrome/browser/content_settings/content_settings_base_provider.h11
-rw-r--r--chrome/browser/geolocation/arbitrator_dependency_factories_for_test.cc30
-rw-r--r--chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h13
-rw-r--r--chrome/browser/net/gaia/token_service_unittest.cc28
-rw-r--r--chrome/browser/net/gaia/token_service_unittest.h22
-rw-r--r--chrome/browser/notifications/desktop_notifications_unittest.cc8
-rw-r--r--chrome/browser/notifications/desktop_notifications_unittest.h6
-rw-r--r--chrome/browser/notifications/notification_test_util.cc26
-rw-r--r--chrome/browser/notifications/notification_test_util.h22
-rw-r--r--chrome/browser/sync/engine/read_node_mock.cc11
-rw-r--r--chrome/browser/sync/engine/read_node_mock.h4
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.h5
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_tests.gypi13
-rw-r--r--chrome/test/bookmark_load_observer.cc15
-rw-r--r--chrome/test/bookmark_load_observer.h10
-rw-r--r--chrome/test/sync/test_http_bridge_factory.cc39
-rw-r--r--chrome/test/sync/test_http_bridge_factory.h29
-rw-r--r--chrome/test/testing_browser_process.cc4
-rw-r--r--chrome/test/testing_browser_process.h2
-rw-r--r--chrome/test/webdriver/commands/execute_command.cc15
-rw-r--r--chrome/test/webdriver/commands/execute_command.h10
-rw-r--r--chrome/test/webdriver/commands/navigate_commands.cc42
-rw-r--r--chrome/test/webdriver/commands/navigate_commands.h27
-rw-r--r--chrome/test/webdriver/commands/session_with_id.cc18
-rw-r--r--chrome/test/webdriver/commands/session_with_id.h13
-rw-r--r--chrome/test/webdriver/commands/source_command.cc14
-rw-r--r--chrome/test/webdriver/commands/source_command.h11
-rw-r--r--chrome/test/webdriver/commands/speed_command.cc20
-rw-r--r--chrome/test/webdriver/commands/speed_command.h12
-rw-r--r--chrome/test/webdriver/commands/title_command.cc14
-rw-r--r--chrome/test/webdriver/commands/title_command.h11
-rw-r--r--chrome/test/webdriver/commands/webelement_commands.cc38
-rw-r--r--chrome/test/webdriver/commands/webelement_commands.h26
37 files changed, 449 insertions, 978 deletions
diff --git a/chrome/browser/autofill/billing_address.h b/chrome/browser/autofill/billing_address.h
deleted file mode 100644
index 4e9f762..0000000
--- a/chrome/browser/autofill/billing_address.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_AUTOFILL_BILLING_ADDRESS_H_
-#define CHROME_BROWSER_AUTOFILL_BILLING_ADDRESS_H_
-#pragma once
-
-#include "chrome/browser/autofill/address.h"
-#include "chrome/browser/autofill/field_types.h"
-
-class FormGroup;
-
-// A specialization of Address that identifies itself as a billing address.
-class BillingAddress : public Address {
- public:
- BillingAddress() {}
- FormGroup* Clone() const { return new BillingAddress(*this); }
-
- protected:
- virtual AutoFillFieldType GetLine1Type() const {
- return ADDRESS_BILLING_LINE1;
- }
-
- virtual AutoFillFieldType GetLine2Type() const {
- return ADDRESS_BILLING_LINE2;
- }
-
- virtual AutoFillFieldType GetAptNumType() const {
- return ADDRESS_BILLING_APT_NUM;
- }
-
- virtual AutoFillFieldType GetCityType() const {
- return ADDRESS_BILLING_CITY;
- }
-
- virtual AutoFillFieldType GetStateType() const {
- return ADDRESS_BILLING_STATE;
- }
-
- virtual AutoFillFieldType GetZipCodeType() const {
- return ADDRESS_BILLING_ZIP;
- }
-
- virtual AutoFillFieldType GetCountryType() const {
- return ADDRESS_BILLING_COUNTRY;
- }
-
- private:
- explicit BillingAddress(const BillingAddress& address) : Address(address) {}
- void operator=(const BillingAddress& address); // Not implemented.
-};
-
-#endif // CHROME_BROWSER_AUTOFILL_BILLING_ADDRESS_H_
diff --git a/chrome/browser/autofill/billing_address_unittest.cc b/chrome/browser/autofill/billing_address_unittest.cc
deleted file mode 100644
index 98d62f0..0000000
--- a/chrome/browser/autofill/billing_address_unittest.cc
+++ /dev/null
@@ -1,787 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/autofill/address.h"
-#include "chrome/browser/autofill/billing_address.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-class BillingAddressTest : public testing::Test {
- public:
- BillingAddressTest() {
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1),
- ASCIIToUTF16("123 Appian Way"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE2),
- ASCIIToUTF16("Unit 6"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("#6"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16("Paris"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_STATE),
- ASCIIToUTF16("Texas"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("12345"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_COUNTRY),
- ASCIIToUTF16("USA"));
- }
-
- protected:
- BillingAddress address_;
-
- DISALLOW_COPY_AND_ASSIGN(BillingAddressTest);
-};
-
-TEST_F(BillingAddressTest, GetPossibleFieldTypes) {
- // Empty string.
- FieldTypeSet possible_types;
- address_.GetPossibleFieldTypes(string16(), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Only use split-chars for the address_.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("-,#. "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // ADDRESS_BILLING_LINE1 =====================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("123 Appian Way"),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // Fields are mixed up.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Way 123 Appian"),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("123 aPPiaN wAy"),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // Case-insensitive match with fields mixed up. The previous test doesn't
- // do a good job of testing for case-insensitivity because the underlying
- // algorithm stops search when it matches '123'.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("wAy aPpIAn"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("123 Appian"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("123 Appian Way #6"),
- &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text in the middle
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("123 Middle Appian Way"),
- &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace doesn't matter.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" 123 Appian Way "),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // Address split characters don't matter.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("-123, #Appian.Way"),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
-
- // ADDRESS_BILLING_LINE2 =====================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Unit 6"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // Fields are mixed up.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("6 Unit"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("uNiT 6"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Unit"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Unit 6 Extra"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text in the middle
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Unit Middle 6"),
- &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace doesn't matter.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" Unit 6 "), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // Address split characters don't matter.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("-#Unit, .6"),
- &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // ADDRESS_BILLING_APT_NUM ===================================================
-
- // Exact match. This matches the apartment number exactly, and also matches
- // 'Unit 6' because of the 6 and the fact that '#' is an address separator,
- // which is ignored in the search for an address line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("#6"), &possible_types);
- ASSERT_EQ(2U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_APT_NUM) !=
- possible_types.end());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_APT_NUM),
- ASCIIToUTF16("Num 10"));
- address_.GetPossibleFieldTypes(ASCIIToUTF16("nuM 10"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_APT_NUM) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Num"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Num 10 More"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text in the middle
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Num Middle 10"),
- &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace does matter for apartment number.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" Num 10 "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // ADDRESS_BILLING_CITY ======================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Paris"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_CITY) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("pARiS"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_CITY) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Par"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Paris City"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace does matter for apartment number.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" Paris "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // ADDRESS_BILLING_STATE =====================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Texas"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_STATE) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("tExAs"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_STATE) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Tex"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Texas State"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace does matter for apartment number.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" Texas "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // ADDRESS_BILLING_COUNTRY ===================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("USA"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_COUNTRY) !=
- possible_types.end());
-
- // The match is case-insensitive.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("uSa"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_COUNTRY) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("US"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("US Country"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace does matter for apartment number.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" US "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // ADDRESS_BILLING_ZIP =======================================================
-
- // Exact match.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("12345"), &possible_types);
- ASSERT_EQ(1U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_ZIP) !=
- possible_types.end());
-
- // The text is not complete.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("1234"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Extra text on the line.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("12345 678"), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Whitespace does matter for apartment number.
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16(" 12345 "), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-
- // Misc ======================================================================
-
- // More than one type can match.
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16("Same"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16("Same"));
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("Same"));
- possible_types.clear();
- address_.GetPossibleFieldTypes(ASCIIToUTF16("Same"), &possible_types);
- ASSERT_EQ(3U, possible_types.size());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE1) !=
- possible_types.end());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_LINE2) !=
- possible_types.end());
- EXPECT_TRUE(possible_types.find(ADDRESS_BILLING_APT_NUM) !=
- possible_types.end());
-
- // LINE1 is empty.
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1), string16());
- possible_types.clear();
- address_.GetPossibleFieldTypes(string16(), &possible_types);
- ASSERT_EQ(0U, possible_types.size());
-}
-
-TEST_F(BillingAddressTest, FindInfoMatches) {
- // ADDRESS_BILLING_LINE1 =====================================================
-
- // Match the beginning of the string.
- std::vector<string16> matches;
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16("123"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16("123 B"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE1), ASCIIToUTF16(" 123"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(AutoFillType(ADDRESS_BILLING_LINE1),
- ASCIIToUTF16("123 Appian Way B"),
- &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.FindInfoMatches(AutoFillType(ADDRESS_BILLING_LINE1),
- ASCIIToUTF16("123 aPpiAN wAy"),
- &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE1), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
-
- // ADDRESS_BILLING_LINE2 =====================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16("Unit"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16("Unita"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16(" Unit"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16("Unit 6B"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), ASCIIToUTF16("uNiT 6"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_LINE2), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), matches[0]);
-
- // ADDRESS_BILLING_APT_NUM ===================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("#"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("#6"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("#a"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16(" #"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("#6B"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("6B"));
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), ASCIIToUTF16("6b"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("6B"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_APT_NUM), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("6B"), matches[0]);
-
- // ADDRESS_BILLING_CITY ======================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16("Par"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Paris"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16("ParA"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16(" Paris"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16("ParisB"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), ASCIIToUTF16("PArIs"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Paris"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_CITY), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Paris"), matches[0]);
-
- // ADDRESS_BILLING_STATE =====================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), ASCIIToUTF16("Tex"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Texas"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), ASCIIToUTF16("TexC"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), ASCIIToUTF16(" Texas"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), ASCIIToUTF16("TexasB"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), ASCIIToUTF16("TeXaS"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Texas"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_STATE), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("Texas"), matches[0]);
-
- // ADDRESS_BILLING_ZIP =======================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("123"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("12345"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("123a"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16(" 123"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("123456"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-sensitive because we should only have numbers in the zip.
- matches.clear();
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("12345A"));
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("12345a"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Reset the zip code.
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_ZIP), ASCIIToUTF16("12345"));
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_ZIP), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("12345"), matches[0]);
-
- // ADDRESS_BILLING_COUNTRY ===================================================
-
- // Match the beginning of the string.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), ASCIIToUTF16("US"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("USA"), matches[0]);
-
- // Search has too many characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), ASCIIToUTF16("USb"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Whitespace at the beginning of the search.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), ASCIIToUTF16(" US"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Search includes the entire match, but adds extra characters.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), ASCIIToUTF16("USAB"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // Matching is case-insensitive.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), ASCIIToUTF16("uSa"), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("USA"), matches[0]);
-
- // Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(ADDRESS_BILLING_COUNTRY), string16(), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("USA"), matches[0]);
-
- // Misc ======================================================================
-
- // |type| is not handled by address_.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(NAME_FIRST), ASCIIToUTF16("USA"), &matches);
- ASSERT_EQ(0U, matches.size());
-
- // |type| is UNKNOWN_TYPE.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(UNKNOWN_TYPE), ASCIIToUTF16("123"), &matches);
- ASSERT_EQ(2U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
- EXPECT_EQ(ASCIIToUTF16("12345"), matches[1]);
-
- // |type| is UNKNOWN_TYPE. Exclude zip because of extra space.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(UNKNOWN_TYPE), ASCIIToUTF16("123 "), &matches);
- ASSERT_EQ(1U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
-
- // |type| is UNKNOWN_TYPE. Search is empty.
- matches.clear();
- address_.FindInfoMatches(
- AutoFillType(UNKNOWN_TYPE), string16(), &matches);
- ASSERT_EQ(7U, matches.size());
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), matches[0]);
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), matches[1]);
- EXPECT_EQ(ASCIIToUTF16("6B"), matches[2]);
- EXPECT_EQ(ASCIIToUTF16("Paris"), matches[3]);
- EXPECT_EQ(ASCIIToUTF16("Texas"), matches[4]);
- EXPECT_EQ(ASCIIToUTF16("12345"), matches[5]);
- EXPECT_EQ(ASCIIToUTF16("USA"), matches[6]);
-}
-
-TEST_F(BillingAddressTest, GetFieldText) {
- // Get the field text.
- string16 text;
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE2));
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_APT_NUM));
- EXPECT_EQ(ASCIIToUTF16("#6"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_CITY));
- EXPECT_EQ(ASCIIToUTF16("Paris"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_STATE));
- EXPECT_EQ(ASCIIToUTF16("Texas"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_ZIP));
- EXPECT_EQ(ASCIIToUTF16("12345"), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_COUNTRY));
- EXPECT_EQ(ASCIIToUTF16("USA"), text);
-
- // |type| is not supported by Billingaddress_.
- text = address_.GetFieldText(AutoFillType(NAME_FIRST));
- EXPECT_EQ(string16(), text);
-}
-
-TEST_F(BillingAddressTest, Clear) {
- // Clear the info.
- string16 text;
- address_.Clear();
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE2));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_APT_NUM));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_CITY));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_STATE));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_ZIP));
- EXPECT_EQ(string16(), text);
- text = address_.GetFieldText(AutoFillType(ADDRESS_BILLING_COUNTRY));
- EXPECT_EQ(string16(), text);
-}
-
-TEST_F(BillingAddressTest, AddressClone) {
- // Clone the info.
- string16 text;
- BillingAddress clone;
- Address* clone_ptr = &clone;
- clone_ptr->Clone(address_);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE2));
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_APT_NUM));
- EXPECT_EQ(ASCIIToUTF16("#6"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_CITY));
- EXPECT_EQ(ASCIIToUTF16("Paris"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_STATE));
- EXPECT_EQ(ASCIIToUTF16("Texas"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_ZIP));
- EXPECT_EQ(ASCIIToUTF16("12345"), text);
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_COUNTRY));
- EXPECT_EQ(ASCIIToUTF16("USA"), text);
-
- // Verify that the clone is a copy and not a reference.
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1),
- ASCIIToUTF16("654 Bowling Terrace"));
- text = clone.GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
-}
-
-TEST_F(BillingAddressTest, BillingAddressClone) {
- // Clone the info.
- string16 text;
- scoped_ptr<FormGroup> clone(address_.Clone());
- ASSERT_NE(static_cast<FormGroup*>(NULL), clone.get());
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_LINE2));
- EXPECT_EQ(ASCIIToUTF16("Unit 6"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_APT_NUM));
- EXPECT_EQ(ASCIIToUTF16("#6"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_CITY));
- EXPECT_EQ(ASCIIToUTF16("Paris"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_STATE));
- EXPECT_EQ(ASCIIToUTF16("Texas"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_ZIP));
- EXPECT_EQ(ASCIIToUTF16("12345"), text);
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_COUNTRY));
- EXPECT_EQ(ASCIIToUTF16("USA"), text);
-
- // Verify that the clone is a copy and not a reference.
- address_.SetInfo(AutoFillType(ADDRESS_BILLING_LINE1),
- ASCIIToUTF16("654 Bowling Terrace"));
- text = clone->GetFieldText(AutoFillType(ADDRESS_BILLING_LINE1));
- EXPECT_EQ(ASCIIToUTF16("123 Appian Way"), text);
-}
-
-} // namespace
diff --git a/chrome/browser/content_settings/content_settings_base_provider.cc b/chrome/browser/content_settings/content_settings_base_provider.cc
index 843b50d..6bc3d66 100644
--- a/chrome/browser/content_settings/content_settings_base_provider.cc
+++ b/chrome/browser/content_settings/content_settings_base_provider.cc
@@ -29,6 +29,22 @@ const bool kRequiresResourceIdentifier[CONTENT_SETTINGS_NUM_TYPES] = {
namespace content_settings {
+ExtendedContentSettings::ExtendedContentSettings() {}
+
+ExtendedContentSettings::ExtendedContentSettings(
+ const ExtendedContentSettings& rhs)
+ : content_settings(rhs.content_settings),
+ content_settings_for_resources(rhs.content_settings_for_resources) {
+}
+
+ExtendedContentSettings::~ExtendedContentSettings() {}
+
+BaseProvider::BaseProvider(bool is_otr)
+ : is_off_the_record_(is_otr) {
+}
+
+BaseProvider::~BaseProvider() {}
+
bool BaseProvider::RequiresResourceIdentifier(
ContentSettingsType content_type) const {
if (CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/chrome/browser/content_settings/content_settings_base_provider.h b/chrome/browser/content_settings/content_settings_base_provider.h
index fa36a2e..d415e82 100644
--- a/chrome/browser/content_settings/content_settings_base_provider.h
+++ b/chrome/browser/content_settings/content_settings_base_provider.h
@@ -21,6 +21,10 @@ typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting>
ResourceContentSettings;
struct ExtendedContentSettings {
+ ExtendedContentSettings();
+ ExtendedContentSettings(const ExtendedContentSettings& rhs);
+ ~ExtendedContentSettings();
+
ContentSettings content_settings;
ResourceContentSettings content_settings_for_resources;
};
@@ -37,10 +41,9 @@ class BaseProvider : public ProviderInterface {
static ContentSetting ClickToPlayFixup(ContentSettingsType content_type,
ContentSetting setting);
- explicit BaseProvider(bool is_otr)
- : is_off_the_record_(is_otr) {
- }
- virtual ~BaseProvider() {}
+ explicit BaseProvider(bool is_otr);
+ virtual ~BaseProvider();
+
// Initializes the Provider.
virtual void Init() = 0;
diff --git a/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.cc b/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.cc
new file mode 100644
index 0000000..9940057
--- /dev/null
+++ b/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h"
+
+GeolocationArbitratorDependencyFactoryWithLocationProvider::
+ GeolocationArbitratorDependencyFactoryWithLocationProvider(
+ LocationProviderFactoryFunction factory_function)
+ : factory_function_(factory_function) {
+}
+
+GeolocationArbitratorDependencyFactoryWithLocationProvider::
+ ~GeolocationArbitratorDependencyFactoryWithLocationProvider() {}
+
+LocationProviderBase*
+GeolocationArbitratorDependencyFactoryWithLocationProvider::
+NewNetworkLocationProvider(
+ AccessTokenStore* access_token_store,
+ URLRequestContextGetter* context,
+ const GURL& url,
+ const string16& access_token) {
+ return factory_function_();
+}
+
+LocationProviderBase*
+GeolocationArbitratorDependencyFactoryWithLocationProvider::
+NewSystemLocationProvider() {
+ return NULL;
+}
diff --git a/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h b/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h
index 1f9ae75..f66aaa4 100644
--- a/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h
+++ b/chrome/browser/geolocation/arbitrator_dependency_factories_for_test.h
@@ -14,21 +14,16 @@ class GeolocationArbitratorDependencyFactoryWithLocationProvider
typedef LocationProviderBase* (*LocationProviderFactoryFunction)(void);
GeolocationArbitratorDependencyFactoryWithLocationProvider(
- LocationProviderFactoryFunction factory_function)
- : factory_function_(factory_function) {
- }
+ LocationProviderFactoryFunction factory_function);
+ virtual ~GeolocationArbitratorDependencyFactoryWithLocationProvider();
virtual LocationProviderBase* NewNetworkLocationProvider(
AccessTokenStore* access_token_store,
URLRequestContextGetter* context,
const GURL& url,
- const string16& access_token) {
- return factory_function_();
- }
+ const string16& access_token);
- virtual LocationProviderBase* NewSystemLocationProvider() {
- return NULL;
- }
+ virtual LocationProviderBase* NewSystemLocationProvider();
protected:
LocationProviderFactoryFunction factory_function_;
diff --git a/chrome/browser/net/gaia/token_service_unittest.cc b/chrome/browser/net/gaia/token_service_unittest.cc
index e3560b6..7050e03 100644
--- a/chrome/browser/net/gaia/token_service_unittest.cc
+++ b/chrome/browser/net/gaia/token_service_unittest.cc
@@ -14,6 +14,34 @@
#include "chrome/common/net/gaia/gaia_constants.h"
#include "chrome/common/net/test_url_fetcher_factory.h"
+TokenAvailableTracker::TokenAvailableTracker() {}
+
+TokenAvailableTracker::~TokenAvailableTracker() {}
+
+void TokenAvailableTracker::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ TestNotificationTracker::Observe(type, source, details);
+ if (type == NotificationType::TOKEN_AVAILABLE) {
+ Details<const TokenService::TokenAvailableDetails> full = details;
+ details_ = *full.ptr();
+ }
+}
+
+TokenFailedTracker::TokenFailedTracker() {}
+
+TokenFailedTracker::~TokenFailedTracker() {}
+
+void TokenFailedTracker::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ TestNotificationTracker::Observe(type, source, details);
+ if (type == NotificationType::TOKEN_REQUEST_FAILED) {
+ Details<const TokenService::TokenRequestFailedDetails> full = details;
+ details_ = *full.ptr();
+ }
+}
+
TokenServiceTestHarness::TokenServiceTestHarness()
: ui_thread_(BrowserThread::UI, &message_loop_),
db_thread_(BrowserThread::DB) {
diff --git a/chrome/browser/net/gaia/token_service_unittest.h b/chrome/browser/net/gaia/token_service_unittest.h
index 8f48e78..3e19114 100644
--- a/chrome/browser/net/gaia/token_service_unittest.h
+++ b/chrome/browser/net/gaia/token_service_unittest.h
@@ -24,6 +24,9 @@
// are a reference on the stack.
class TokenAvailableTracker : public TestNotificationTracker {
public:
+ TokenAvailableTracker();
+ virtual ~TokenAvailableTracker();
+
const TokenService::TokenAvailableDetails& details() {
return details_;
}
@@ -31,19 +34,16 @@ class TokenAvailableTracker : public TestNotificationTracker {
private:
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details) {
- TestNotificationTracker::Observe(type, source, details);
- if (type == NotificationType::TOKEN_AVAILABLE) {
- Details<const TokenService::TokenAvailableDetails> full = details;
- details_ = *full.ptr();
- }
- }
+ const NotificationDetails& details);
TokenService::TokenAvailableDetails details_;
};
class TokenFailedTracker : public TestNotificationTracker {
public:
+ TokenFailedTracker();
+ virtual ~TokenFailedTracker();
+
const TokenService::TokenRequestFailedDetails& details() {
return details_;
}
@@ -51,13 +51,7 @@ class TokenFailedTracker : public TestNotificationTracker {
private:
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details) {
- TestNotificationTracker::Observe(type, source, details);
- if (type == NotificationType::TOKEN_REQUEST_FAILED) {
- Details<const TokenService::TokenRequestFailedDetails> full = details;
- details_ = *full.ptr();
- }
- }
+ const NotificationDetails& details);
TokenService::TokenRequestFailedDetails details_;
};
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc
index 6effdf1..1470cb6 100644
--- a/chrome/browser/notifications/desktop_notifications_unittest.cc
+++ b/chrome/browser/notifications/desktop_notifications_unittest.cc
@@ -35,6 +35,10 @@ void MockBalloonCollection::Add(const Notification& notification,
BalloonCollectionImpl::Add(test_notification, profile);
}
+bool MockBalloonCollection::HasSpace() const {
+ return count() < kMockBalloonSpace;
+}
+
Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification,
Profile* profile) {
// Start with a normal balloon but mock out the view.
@@ -55,6 +59,10 @@ void MockBalloonCollection::OnBalloonClosed(Balloon* source) {
}
}
+const BalloonCollection::Balloons& MockBalloonCollection::GetActiveBalloons() {
+ return balloons_;
+}
+
int MockBalloonCollection::UppermostVerticalPosition() {
int min = 0;
std::deque<Balloon*>::iterator iter;
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h
index 25e5270..faa470a 100644
--- a/chrome/browser/notifications/desktop_notifications_unittest.h
+++ b/chrome/browser/notifications/desktop_notifications_unittest.h
@@ -39,14 +39,12 @@ class MockBalloonCollection : public BalloonCollectionImpl {
// BalloonCollectionImpl overrides
virtual void Add(const Notification& notification,
Profile* profile);
- virtual bool HasSpace() const { return count() < kMockBalloonSpace; }
+ virtual bool HasSpace() const;
virtual Balloon* MakeBalloon(const Notification& notification,
Profile* profile);
virtual void DisplayChanged() {}
virtual void OnBalloonClosed(Balloon* source);
- virtual const BalloonCollection::Balloons& GetActiveBalloons() {
- return balloons_;
- }
+ virtual const BalloonCollection::Balloons& GetActiveBalloons();
// Number of balloons being shown.
std::deque<Balloon*>& balloons() { return balloons_; }
diff --git a/chrome/browser/notifications/notification_test_util.cc b/chrome/browser/notifications/notification_test_util.cc
new file mode 100644
index 0000000..540e296
--- /dev/null
+++ b/chrome/browser/notifications/notification_test_util.cc
@@ -0,0 +1,26 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/notifications/notification_test_util.h"
+
+MockNotificationDelegate::MockNotificationDelegate(const std::string& id)
+ : id_(id) {}
+
+MockNotificationDelegate::~MockNotificationDelegate() {}
+
+std::string MockNotificationDelegate::id() const {
+ return id_;
+}
+
+void MockBalloonView::Close(bool by_user) {
+ balloon_->OnClose(by_user);
+}
+
+gfx::Size MockBalloonView::GetSize() const {
+ return balloon_->content_size();
+}
+
+BalloonHost* MockBalloonView::GetHost() const {
+ return NULL;
+}
diff --git a/chrome/browser/notifications/notification_test_util.h b/chrome/browser/notifications/notification_test_util.h
index 38863cf..19b1fd7 100644
--- a/chrome/browser/notifications/notification_test_util.h
+++ b/chrome/browser/notifications/notification_test_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,15 +16,15 @@
// the notification events are not important.
class MockNotificationDelegate : public NotificationDelegate {
public:
- explicit MockNotificationDelegate(const std::string& id) : id_(id) {}
- virtual ~MockNotificationDelegate() {}
+ explicit MockNotificationDelegate(const std::string& id);
+ virtual ~MockNotificationDelegate();
// NotificationDelegate interface.
virtual void Display() {}
virtual void Error() {}
virtual void Close(bool by_user) {}
virtual void Click() {}
- virtual std::string id() const { return id_; }
+ virtual std::string id() const;
private:
std::string id_;
@@ -77,12 +77,14 @@ class MockBalloonView : public BalloonView {
public:
explicit MockBalloonView(Balloon * balloon) :
balloon_(balloon) {}
- void Show(Balloon* balloon) {}
- void Update() {}
- void RepositionToBalloon() {}
- void Close(bool by_user) { balloon_->OnClose(by_user); }
- gfx::Size GetSize() const { return balloon_->content_size(); }
- BalloonHost* GetHost() const { return NULL; }
+
+ // BalloonView:
+ virtual void Show(Balloon* balloon) {}
+ virtual void Update() {}
+ virtual void RepositionToBalloon() {}
+ virtual void Close(bool by_user);
+ virtual gfx::Size GetSize() const;
+ virtual BalloonHost* GetHost() const;
private:
// Non-owned pointer.
diff --git a/chrome/browser/sync/engine/read_node_mock.cc b/chrome/browser/sync/engine/read_node_mock.cc
new file mode 100644
index 0000000..6916688
--- /dev/null
+++ b/chrome/browser/sync/engine/read_node_mock.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/engine/read_node_mock.h"
+
+#include "chrome/browser/sync/protocol/autofill_specifics.pb.h"
+
+ReadNodeMock::ReadNodeMock() {}
+
+ReadNodeMock::~ReadNodeMock() {}
diff --git a/chrome/browser/sync/engine/read_node_mock.h b/chrome/browser/sync/engine/read_node_mock.h
index 564f01d..9d31f6f 100644
--- a/chrome/browser/sync/engine/read_node_mock.h
+++ b/chrome/browser/sync/engine/read_node_mock.h
@@ -13,8 +13,8 @@
class ReadNodeMock : public sync_api::ReadNode {
public:
- ReadNodeMock() {}
- virtual ~ReadNodeMock() {}
+ ReadNodeMock();
+ virtual ~ReadNodeMock();
MOCK_METHOD2(InitByClientTagLookup,
bool(syncable::ModelType model_type, const std::string& tag));
diff --git a/chrome/browser/ui/browser_navigator_browsertest.h b/chrome/browser/ui/browser_navigator_browsertest.h
index 0f18da5..cb18e77 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.h
+++ b/chrome/browser/ui/browser_navigator_browsertest.h
@@ -36,8 +36,9 @@ class BrowserNavigatorTest : public InProcessBrowserTest,
void RunSuppressTest(WindowOpenDisposition disposition);
- void Observe(NotificationType type, const NotificationSource& source,
- const NotificationDetails& details);
+ // NotificationObserver:
+ virtual void Observe(NotificationType type, const NotificationSource& source,
+ const NotificationDetails& details);
size_t created_tab_contents_count_;
};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 7400114..731a3e1 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -187,7 +187,6 @@
'browser/autofill/autofill_type.h',
'browser/autofill/autofill_xml_parser.cc',
'browser/autofill/autofill_xml_parser.h',
- 'browser/autofill/billing_address.h',
'browser/autofill/contact_info.cc',
'browser/autofill/contact_info.h',
'browser/autofill/credit_card.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index f1620a0..a4aa8f9 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -57,6 +57,8 @@
# The only thing used from browser is Browser::Type.
'browser/extensions/test_extension_prefs.cc',
'browser/extensions/test_extension_prefs.h',
+ 'browser/geolocation/arbitrator_dependency_factories_for_test.cc',
+ 'browser/geolocation/arbitrator_dependency_factories_for_test.h',
'browser/geolocation/mock_location_provider.cc',
'browser/geolocation/mock_location_provider.h',
'browser/mock_browsing_data_appcache_helper.cc',
@@ -73,6 +75,8 @@
#'browser/net/url_request_mock_http_job.h',
'browser/net/url_request_mock_net_error_job.cc',
'browser/net/url_request_mock_net_error_job.h',
+ 'browser/notifications/notification_test_util.cc',
+ 'browser/notifications/notification_test_util.h',
'browser/prefs/pref_observer_mock.cc',
'browser/prefs/pref_observer_mock.h',
'browser/prefs/pref_service_mock_builder.cc',
@@ -134,6 +138,8 @@
'test/automation/tab_proxy.h',
'test/automation/window_proxy.cc',
'test/automation/window_proxy.h',
+ 'test/bookmark_load_observer.cc',
+ 'test/bookmark_load_observer.h',
'test/chrome_process_util.cc',
'test/chrome_process_util.h',
'test/chrome_process_util_mac.cc',
@@ -1158,7 +1164,6 @@
'browser/autofill/autofill_profile_unittest.cc',
'browser/autofill/autofill_type_unittest.cc',
'browser/autofill/autofill_xml_parser_unittest.cc',
- 'browser/autofill/billing_address_unittest.cc',
'browser/autofill/contact_info_unittest.cc',
'browser/autofill/credit_card_field_unittest.cc',
'browser/autofill/credit_card_unittest.cc',
@@ -1382,7 +1387,6 @@
'browser/notifications/desktop_notifications_unittest.h',
'browser/notifications/desktop_notifications_unittest.cc',
'browser/notifications/notification_exceptions_table_model_unittest.cc',
- 'browser/notifications/notification_test_util.h',
'browser/notifications/notifications_prefs_cache_unittest.cc',
'browser/parsers/metadata_parser_filebase_unittest.cc',
'browser/password_manager/encryptor_unittest.cc',
@@ -1491,6 +1495,8 @@
'browser/status_icons/status_tray_unittest.cc',
'browser/sync/abstract_profile_sync_service_test.cc',
'browser/sync/abstract_profile_sync_service_test.h',
+ 'browser/sync/engine/read_node_mock.cc',
+ 'browser/sync/engine/read_node_mock.h',
'browser/sync/glue/autofill_data_type_controller_unittest.cc',
'browser/sync/glue/autofill_model_associator_unittest.cc',
'browser/sync/glue/autofill_profile_model_associator_unittest.cc',
@@ -1830,6 +1836,7 @@
'test/menu_model_test.h',
'test/render_view_test.cc',
'test/render_view_test.h',
+ 'test/sync/test_http_bridge_factory.cc',
'test/sync/test_http_bridge_factory.h',
'test/test_notification_tracker.cc',
'test/test_notification_tracker.h',
@@ -2822,7 +2829,6 @@
'browser/sync/engine/mock_model_safe_workers.cc',
'browser/sync/engine/mock_model_safe_workers.h',
'browser/sync/engine/process_commit_response_command_unittest.cc',
- 'browser/sync/engine/read_node_mock.h',
'browser/sync/engine/syncapi_unittest.cc',
'browser/sync/engine/syncer_proto_util_unittest.cc',
'browser/sync/engine/syncer_thread_unittest.cc',
@@ -2995,7 +3001,6 @@
'browser/password_manager/password_form_data.cc',
'browser/sessions/session_backend.cc',
'browser/sync/glue/session_model_associator.cc',
- 'test/bookmark_load_observer.h',
'test/out_of_proc_test_runner.cc',
'test/live_sync/bookmark_model_verifier.cc',
'test/live_sync/bookmark_model_verifier.h',
diff --git a/chrome/test/bookmark_load_observer.cc b/chrome/test/bookmark_load_observer.cc
new file mode 100644
index 0000000..ccea575
--- /dev/null
+++ b/chrome/test/bookmark_load_observer.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/bookmark_load_observer.h"
+
+#include "base/message_loop.h"
+
+BookmarkLoadObserver::BookmarkLoadObserver() {}
+
+BookmarkLoadObserver::~BookmarkLoadObserver() {}
+
+void BookmarkLoadObserver::Loaded(BookmarkModel* model) {
+ MessageLoop::current()->Quit();
+}
diff --git a/chrome/test/bookmark_load_observer.h b/chrome/test/bookmark_load_observer.h
index cf3de21..0d08410 100644
--- a/chrome/test/bookmark_load_observer.h
+++ b/chrome/test/bookmark_load_observer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@
#define CHROME_TEST_BOOKMARK_LOAD_OBSERVER_H_
#pragma once
-#include "base/message_loop.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
// BookmarkLoadObserver is used when blocking until the BookmarkModel
@@ -14,10 +13,9 @@
// loop is quit.
class BookmarkLoadObserver : public BookmarkModelObserver {
public:
- BookmarkLoadObserver() {}
- virtual void Loaded(BookmarkModel* model) {
- MessageLoop::current()->Quit();
- }
+ BookmarkLoadObserver();
+ virtual ~BookmarkLoadObserver();
+ virtual void Loaded(BookmarkModel* model);
virtual void BookmarkNodeMoved(BookmarkModel* model,
const BookmarkNode* old_parent,
diff --git a/chrome/test/sync/test_http_bridge_factory.cc b/chrome/test/sync/test_http_bridge_factory.cc
new file mode 100644
index 0000000..4e630a0
--- /dev/null
+++ b/chrome/test/sync/test_http_bridge_factory.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/sync/test_http_bridge_factory.h"
+
+namespace browser_sync {
+
+bool TestHttpBridge::MakeSynchronousPost(int* os_error_code,
+ int* response_code) {
+ return false;
+}
+
+int TestHttpBridge::GetResponseContentLength() const {
+ return 0;
+}
+
+const char* TestHttpBridge::GetResponseContent() const {
+ return 0;
+}
+
+const std::string TestHttpBridge::GetResponseHeaderValue(
+ const std::string &) const {
+ return std::string();
+}
+
+TestHttpBridgeFactory::TestHttpBridgeFactory() {}
+
+TestHttpBridgeFactory::~TestHttpBridgeFactory() {}
+
+sync_api::HttpPostProviderInterface* TestHttpBridgeFactory::Create() {
+ return new TestHttpBridge();
+}
+
+void TestHttpBridgeFactory::Destroy(sync_api::HttpPostProviderInterface* http) {
+ delete http;
+}
+
+} // namespace browser_sync
diff --git a/chrome/test/sync/test_http_bridge_factory.h b/chrome/test/sync/test_http_bridge_factory.h
index 9f82711..40e8369 100644
--- a/chrome/test/sync/test_http_bridge_factory.h
+++ b/chrome/test/sync/test_http_bridge_factory.h
@@ -30,41 +30,30 @@ class TestHttpBridge : public sync_api::HttpPostProviderInterface {
// Returns true if the URL request succeeded. If the request failed,
// os_error() may be non-zero and hence contain more information.
- virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) {
- return false;
- }
+ virtual bool MakeSynchronousPost(int* os_error_code, int* response_code);
// Get the length of the content returned in the HTTP response.
// This does not count the trailing null-terminating character returned
// by GetResponseContent, so it is analogous to calling string.length.
- virtual int GetResponseContentLength() const {
- return 0;
- }
+ virtual int GetResponseContentLength() const;
// Get the content returned in the HTTP response.
// This is a null terminated string of characters.
// Value should be copied.
- virtual const char* GetResponseContent() const {
- return 0;
- }
+ virtual const char* GetResponseContent() const;
- virtual const std::string GetResponseHeaderValue(const std::string &) const {
- return std::string();
- }
+ virtual const std::string GetResponseHeaderValue(const std::string&) const;
};
class TestHttpBridgeFactory : public sync_api::HttpPostProviderFactory {
public:
// Override everything to do nothing.
- TestHttpBridgeFactory() {}
- ~TestHttpBridgeFactory() {}
+ TestHttpBridgeFactory();
+ virtual ~TestHttpBridgeFactory();
- virtual sync_api::HttpPostProviderInterface* Create() {
- return new TestHttpBridge();
- }
- virtual void Destroy(sync_api::HttpPostProviderInterface* http) {
- delete http;
- }
+ // sync_api::HttpPostProviderFactory:
+ virtual sync_api::HttpPostProviderInterface* Create();
+ virtual void Destroy(sync_api::HttpPostProviderInterface* http);
};
} // namespace browser_sync
diff --git a/chrome/test/testing_browser_process.cc b/chrome/test/testing_browser_process.cc
index 4d50fa4..30e8064 100644
--- a/chrome/test/testing_browser_process.cc
+++ b/chrome/test/testing_browser_process.cc
@@ -184,6 +184,10 @@ bool TestingBrowserProcess::have_inspector_files() const {
return true;
}
+ChromeNetLog* TestingBrowserProcess::net_log() {
+ return NULL;
+}
+
void TestingBrowserProcess::SetPrefService(PrefService* pref_service) {
pref_service_ = pref_service;
}
diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h
index 0ee682a..4c38824 100644
--- a/chrome/test/testing_browser_process.h
+++ b/chrome/test/testing_browser_process.h
@@ -120,7 +120,7 @@ class TestingBrowserProcess : public BrowserProcess {
virtual bool have_inspector_files() const;
- virtual ChromeNetLog* net_log() { return NULL; }
+ virtual ChromeNetLog* net_log();
#if defined(IPC_MESSAGE_LOG_ENABLED)
virtual void SetIPCLoggingEnabled(bool enable) {}
diff --git a/chrome/test/webdriver/commands/execute_command.cc b/chrome/test/webdriver/commands/execute_command.cc
index 96a0983..dc68e41 100644
--- a/chrome/test/webdriver/commands/execute_command.cc
+++ b/chrome/test/webdriver/commands/execute_command.cc
@@ -13,6 +13,13 @@ namespace webdriver {
const char kArgs[] = "args";
const char kScript[] = "script";
+ExecuteCommand::ExecuteCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+ExecuteCommand::~ExecuteCommand() {}
+
+
bool ExecuteCommand::Init(Response* const response) {
if (!WebDriverCommand::Init(response)) {
SET_WEBDRIVER_ERROR(response, "Failure on Init for execute command",
@@ -30,6 +37,10 @@ bool ExecuteCommand::Init(Response* const response) {
return true;
}
+bool ExecuteCommand::DoesPost() {
+ return true;
+}
+
void ExecuteCommand::ExecutePost(Response* const response) {
int error_code = 0;
std::string error_msg;
@@ -73,5 +84,9 @@ void ExecuteCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+bool ExecuteCommand::RequiresValidTab() {
+ return true;
+}
+
} // namspace webdriver
diff --git a/chrome/test/webdriver/commands/execute_command.h b/chrome/test/webdriver/commands/execute_command.h
index b431bb1..9a57854 100644
--- a/chrome/test/webdriver/commands/execute_command.h
+++ b/chrome/test/webdriver/commands/execute_command.h
@@ -21,20 +21,20 @@ namespace webdriver {
class ExecuteCommand : public WebDriverCommand {
public:
ExecuteCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~ExecuteCommand() {}
+ const DictionaryValue* const parameters);
+ virtual ~ExecuteCommand();
virtual bool Init(Response* const response);
- virtual bool DoesPost() { return true; }
+ virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
+ virtual bool RequiresValidTab();
+
std::string script_;
bool has_args_;
std::string args_;
- virtual bool RequiresValidTab() { return true; }
DISALLOW_COPY_AND_ASSIGN(ExecuteCommand);
};
diff --git a/chrome/test/webdriver/commands/navigate_commands.cc b/chrome/test/webdriver/commands/navigate_commands.cc
index 7fbb54f..75f9a1a 100644
--- a/chrome/test/webdriver/commands/navigate_commands.cc
+++ b/chrome/test/webdriver/commands/navigate_commands.cc
@@ -6,6 +6,16 @@
namespace webdriver {
+ForwardCommand::ForwardCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+ForwardCommand::~ForwardCommand() {}
+
+bool ForwardCommand::DoesPost() {
+ return true;
+}
+
void ForwardCommand::ExecutePost(Response* const response) {
if (!session_->GoForward()) {
SET_WEBDRIVER_ERROR(response, "GoForward failed", kInternalServerError);
@@ -16,6 +26,20 @@ void ForwardCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+bool ForwardCommand::RequiresValidTab() {
+ return true;
+}
+
+BackCommand::BackCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+BackCommand::~BackCommand() {}
+
+bool BackCommand::DoesPost() {
+ return true;
+}
+
void BackCommand::ExecutePost(Response* const response) {
if (!session_->GoBack()) {
SET_WEBDRIVER_ERROR(response, "GoBack failed", kInternalServerError);
@@ -26,6 +50,20 @@ void BackCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+bool BackCommand::RequiresValidTab() {
+ return true;
+}
+
+RefreshCommand::RefreshCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+RefreshCommand::~RefreshCommand() {}
+
+bool RefreshCommand::DoesPost() {
+ return true;
+}
+
void RefreshCommand::ExecutePost(Response* const response) {
if (!session_->Reload()) {
SET_WEBDRIVER_ERROR(response, "Reload failed", kInternalServerError);
@@ -36,4 +74,8 @@ void RefreshCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+bool RefreshCommand::RequiresValidTab() {
+ return true;
+}
+
} // namespace webdriver
diff --git a/chrome/test/webdriver/commands/navigate_commands.h b/chrome/test/webdriver/commands/navigate_commands.h
index a913315..754e868 100644
--- a/chrome/test/webdriver/commands/navigate_commands.h
+++ b/chrome/test/webdriver/commands/navigate_commands.h
@@ -17,15 +17,14 @@ namespace webdriver {
class ForwardCommand : public WebDriverCommand {
public:
ForwardCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~ForwardCommand() {}
+ const DictionaryValue* const parameters);
+ virtual ~ForwardCommand();
- virtual bool DoesPost() { return true; }
+ virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(ForwardCommand);
};
@@ -35,15 +34,14 @@ class ForwardCommand : public WebDriverCommand {
class BackCommand : public WebDriverCommand {
public:
BackCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~BackCommand() {}
+ const DictionaryValue* const parameters);
+ virtual ~BackCommand();
- virtual bool DoesPost() { return true; }
+ virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(BackCommand);
};
@@ -53,15 +51,14 @@ class BackCommand : public WebDriverCommand {
class RefreshCommand : public WebDriverCommand {
public:
RefreshCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~RefreshCommand() {}
+ const DictionaryValue* const parameters);
+ virtual ~RefreshCommand();
- virtual bool DoesPost() { return true; }
+ virtual bool DoesPost();
virtual void ExecutePost(Response* const response);
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(RefreshCommand);
};
diff --git a/chrome/test/webdriver/commands/session_with_id.cc b/chrome/test/webdriver/commands/session_with_id.cc
index ed1614f..6ea3f3b 100644
--- a/chrome/test/webdriver/commands/session_with_id.cc
+++ b/chrome/test/webdriver/commands/session_with_id.cc
@@ -13,6 +13,20 @@
namespace webdriver {
+SessionWithID::SessionWithID(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+SessionWithID::~SessionWithID() {}
+
+bool SessionWithID::DoesGet() {
+ return true;
+}
+
+bool SessionWithID::DoesDelete() {
+ return true;
+}
+
void SessionWithID::ExecuteGet(Response* const response) {
DictionaryValue *temp_value = new DictionaryValue();
@@ -45,4 +59,8 @@ void SessionWithID::ExecuteDelete(Response* const response) {
response->set_status(kSuccess);
}
+bool SessionWithID::RequiresValidTab() {
+ return false;
+}
+
} // namespace webdriver
diff --git a/chrome/test/webdriver/commands/session_with_id.h b/chrome/test/webdriver/commands/session_with_id.h
index a85bc5f..8084716 100644
--- a/chrome/test/webdriver/commands/session_with_id.h
+++ b/chrome/test/webdriver/commands/session_with_id.h
@@ -22,19 +22,18 @@ namespace webdriver {
// files and directories created are deleted.
class SessionWithID : public WebDriverCommand {
public:
- inline SessionWithID(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~SessionWithID() {}
+ SessionWithID(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters);
+ virtual ~SessionWithID();
- virtual bool DoesGet() { return true; }
- virtual bool DoesDelete() { return true; }
+ virtual bool DoesGet();
+ virtual bool DoesDelete();
virtual void ExecuteGet(Response* const response);
virtual void ExecuteDelete(Response* const response);
private:
- virtual bool RequiresValidTab() { return false; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(SessionWithID);
};
diff --git a/chrome/test/webdriver/commands/source_command.cc b/chrome/test/webdriver/commands/source_command.cc
index 706d3ea..1e6b653 100644
--- a/chrome/test/webdriver/commands/source_command.cc
+++ b/chrome/test/webdriver/commands/source_command.cc
@@ -15,6 +15,16 @@ const wchar_t* const kSource[] = {
L"new XMLSerializer().serializeToString(document));",
};
+SourceCommand::SourceCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+SourceCommand::~SourceCommand() {}
+
+bool SourceCommand::DoesGet() {
+ return true;
+}
+
void SourceCommand::ExecuteGet(Response* const response) {
std::string jscript = build_atom(kSource, sizeof kSource);
Value* result = NULL;
@@ -33,4 +43,8 @@ void SourceCommand::ExecuteGet(Response* const response) {
response->set_status(kSuccess);
}
+bool SourceCommand::RequiresValidTab() {
+ return true;
+}
+
} // namespace webdriver
diff --git a/chrome/test/webdriver/commands/source_command.h b/chrome/test/webdriver/commands/source_command.h
index ce9445b..f259e0e 100644
--- a/chrome/test/webdriver/commands/source_command.h
+++ b/chrome/test/webdriver/commands/source_command.h
@@ -17,16 +17,15 @@ namespace webdriver {
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/source
class SourceCommand : public WebDriverCommand {
public:
- inline SourceCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~SourceCommand() {}
+ SourceCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters);
+ virtual ~SourceCommand();
- virtual bool DoesGet() { return true; }
+ virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(SourceCommand);
};
diff --git a/chrome/test/webdriver/commands/speed_command.cc b/chrome/test/webdriver/commands/speed_command.cc
index e09602d..95b4abd 100644
--- a/chrome/test/webdriver/commands/speed_command.cc
+++ b/chrome/test/webdriver/commands/speed_command.cc
@@ -9,6 +9,14 @@
namespace webdriver {
+SpeedCommand::SpeedCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters),
+ speed_(Session::kMedium) {
+}
+
+SpeedCommand::~SpeedCommand() {}
+
bool SpeedCommand::Init(Response* const response) {
std::string speed;
@@ -44,6 +52,14 @@ bool SpeedCommand::Init(Response* const response) {
return true;
}
+bool SpeedCommand::DoesGet() {
+ return true;
+}
+
+bool SpeedCommand::DoesPost() {
+ return true;
+}
+
void SpeedCommand::ExecuteGet(Response* const response) {
switch (session_->speed()) {
case Session::kSlow:
@@ -82,5 +98,9 @@ void SpeedCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+bool SpeedCommand::RequiresValidTab() {
+ return true;
+}
+
} // namespace webdriver
diff --git a/chrome/test/webdriver/commands/speed_command.h b/chrome/test/webdriver/commands/speed_command.h
index 7c8c7eb..6bd84a3 100644
--- a/chrome/test/webdriver/commands/speed_command.h
+++ b/chrome/test/webdriver/commands/speed_command.h
@@ -20,20 +20,20 @@ namespace webdriver {
class SpeedCommand : public WebDriverCommand {
public:
SpeedCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters), speed_(Session::kMedium) {}
- virtual ~SpeedCommand() {}
+ const DictionaryValue* const parameters);
+ virtual ~SpeedCommand();
virtual bool Init(Response* const response);
- virtual bool DoesGet() { return true; }
- virtual bool DoesPost() { return true; }
+ virtual bool DoesGet();
+ virtual bool DoesPost();
virtual void ExecuteGet(Response* const response);
virtual void ExecutePost(Response* const response);
private:
+ virtual bool RequiresValidTab();
+
Session::Speed speed_;
- virtual bool RequiresValidTab() { return true; }
DISALLOW_COPY_AND_ASSIGN(SpeedCommand);
};
diff --git a/chrome/test/webdriver/commands/title_command.cc b/chrome/test/webdriver/commands/title_command.cc
index 1213895..12eaa37 100644
--- a/chrome/test/webdriver/commands/title_command.cc
+++ b/chrome/test/webdriver/commands/title_command.cc
@@ -8,6 +8,16 @@
namespace webdriver {
+TitleCommand::TitleCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+
+TitleCommand::~TitleCommand() {}
+
+bool TitleCommand::DoesGet() {
+ return true;
+}
+
void TitleCommand::ExecuteGet(Response* const response) {
std::string title;
if (!session_->GetTabTitle(&title)) {
@@ -19,4 +29,8 @@ void TitleCommand::ExecuteGet(Response* const response) {
response->set_status(kSuccess);
}
+bool TitleCommand::RequiresValidTab() {
+ return true;
+}
+
} // namespace webdriver
diff --git a/chrome/test/webdriver/commands/title_command.h b/chrome/test/webdriver/commands/title_command.h
index c9925c2..e017b29 100644
--- a/chrome/test/webdriver/commands/title_command.h
+++ b/chrome/test/webdriver/commands/title_command.h
@@ -16,16 +16,15 @@ namespace webdriver {
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/title
class TitleCommand : public WebDriverCommand {
public:
- inline TitleCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters) {}
- virtual ~TitleCommand() {}
+ TitleCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters);
+ virtual ~TitleCommand();
- virtual bool DoesGet() { return true; }
+ virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(TitleCommand);
};
diff --git a/chrome/test/webdriver/commands/webelement_commands.cc b/chrome/test/webdriver/commands/webelement_commands.cc
index e9bb7c47..b5a2021d 100644
--- a/chrome/test/webdriver/commands/webelement_commands.cc
+++ b/chrome/test/webdriver/commands/webelement_commands.cc
@@ -15,6 +15,14 @@
namespace webdriver {
+WebElementCommand::WebElementCommand(
+ const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters),
+ path_segments_(path_segments) {}
+
+WebElementCommand::~WebElementCommand() {}
+
bool WebElementCommand::Init(Response* const response) {
if (!WebDriverCommand::Init(response))
return false;
@@ -84,6 +92,25 @@ bool WebElementCommand::GetElementSize(int* width, int* height) {
dict->GetInteger("height", height);
}
+bool WebElementCommand::RequiresValidTab() {
+ return true;
+}
+
+ElementValueCommand::ElementValueCommand(
+ const std::vector<std::string>& path_segments,
+ DictionaryValue* parameters)
+ : WebElementCommand(path_segments, parameters) {}
+
+ElementValueCommand::~ElementValueCommand() {}
+
+bool ElementValueCommand::DoesGet() {
+ return true;
+}
+
+bool ElementValueCommand::DoesPost() {
+ return true;
+}
+
void ElementValueCommand::ExecuteGet(Response* const response) {
Value* unscoped_result = NULL;
ListValue args;
@@ -143,6 +170,17 @@ void ElementValueCommand::ExecutePost(Response* const response) {
response->set_status(kSuccess);
}
+ElementTextCommand::ElementTextCommand(
+ const std::vector<std::string>& path_segments,
+ DictionaryValue* parameters)
+ : WebElementCommand(path_segments, parameters) {}
+
+ElementTextCommand::~ElementTextCommand() {}
+
+bool ElementTextCommand::DoesGet() {
+ return true;
+}
+
void ElementTextCommand::ExecuteGet(Response* const response) {
Value* unscoped_result = NULL;
ListValue args;
diff --git a/chrome/test/webdriver/commands/webelement_commands.h b/chrome/test/webdriver/commands/webelement_commands.h
index ec5d6b7..0484742 100644
--- a/chrome/test/webdriver/commands/webelement_commands.h
+++ b/chrome/test/webdriver/commands/webelement_commands.h
@@ -20,11 +20,9 @@ class Response;
// service.
class WebElementCommand : public WebDriverCommand {
public:
- inline WebElementCommand(const std::vector<std::string>& path_segments,
- const DictionaryValue* const parameters)
- : WebDriverCommand(path_segments, parameters),
- path_segments_(path_segments) {}
- virtual ~WebElementCommand() {}
+ WebElementCommand(const std::vector<std::string>& path_segments,
+ const DictionaryValue* const parameters);
+ virtual ~WebElementCommand();
virtual bool Init(Response* const response);
@@ -36,7 +34,7 @@ class WebElementCommand : public WebDriverCommand {
std::string element_id;
private:
- virtual bool RequiresValidTab() { return true; }
+ virtual bool RequiresValidTab();
DISALLOW_COPY_AND_ASSIGN(WebElementCommand);
};
@@ -47,12 +45,11 @@ class WebElementCommand : public WebDriverCommand {
class ElementValueCommand : public WebElementCommand {
public:
ElementValueCommand(const std::vector<std::string>& path_segments,
- DictionaryValue* parameters)
- : WebElementCommand(path_segments, parameters) {}
- virtual ~ElementValueCommand() {}
+ DictionaryValue* parameters);
+ virtual ~ElementValueCommand();
- virtual bool DoesGet() { return true; }
- virtual bool DoesPost() { return true; }
+ virtual bool DoesGet();
+ virtual bool DoesPost();
virtual void ExecuteGet(Response* const response);
virtual void ExecutePost(Response* const response);
@@ -65,11 +62,10 @@ class ElementValueCommand : public WebElementCommand {
class ElementTextCommand : public WebElementCommand {
public:
ElementTextCommand(const std::vector<std::string>& path_segments,
- DictionaryValue* parameters)
- : WebElementCommand(path_segments, parameters) {}
- virtual ~ElementTextCommand() {}
+ DictionaryValue* parameters);
+ virtual ~ElementTextCommand();
- virtual bool DoesGet() { return true; }
+ virtual bool DoesGet();
virtual void ExecuteGet(Response* const response);
private: