blob: 2563905da8ca8094850219806bece379dfc0022f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// 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 <set>
#include <string>
#include "chrome/test/webdriver/utility_functions.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(RandomIDTest, CanGenerateSufficientlyRandomIDs) {
std::set<std::string> generated_ids;
for (int i = 0; i < 10000; ++i) {
std::string id = webdriver::GenerateRandomID();
ASSERT_EQ(32u, id.length());
ASSERT_TRUE(generated_ids.end() == generated_ids.find(id))
<< "Generated duplicate ID: " << id
<< " on iteration " << i;
generated_ids.insert(id);
}
}
|